Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid implicit try-catch #161

Closed
iromli opened this issue Sep 2, 2020 · 0 comments
Closed

Avoid implicit try-catch #161

iromli opened this issue Sep 2, 2020 · 0 comments
Assignees
Labels
enhancement New feature or request Low Priority Priority level low

Comments

@iromli
Copy link
Contributor

iromli commented Sep 2, 2020

The following code makes debugging a little bit harder:

try:
    # do something
except:
    return False

We should explicitly specify the exception, for example:

try:
    # do something
except ValueError:
    return False

or

try:
    # do something
except Exception as exc:
    logger.debug(f"Uncaught error={exc}")
    return False

Given this new style try-catch, we can avoid errors like NameError, SyntaxError, etc. (which should be fixed by developer) or any runtime errors.

@iromli iromli added the enhancement New feature or request label Sep 2, 2020
@iromli iromli added the Low Priority Priority level low label Sep 2, 2020
@moabu moabu closed this as completed in dae1263 Sep 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request Low Priority Priority level low
Projects
None yet
Development

No branches or pull requests

2 participants