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

Refactor code to handle errors more precisely #71

Open
1 task
DavidRomanovizc opened this issue May 2, 2023 · 0 comments
Open
1 task

Refactor code to handle errors more precisely #71

DavidRomanovizc opened this issue May 2, 2023 · 0 comments
Labels
Priority: Low This issue can probably be picked up by anyone looking to contribute to the project, as an entry fix Status: Blocked Another prior issue or need for specific input to make progress. External blockers may also exist Type: Difficult a long problem and a difficult one

Comments

@DavidRomanovizc
Copy link
Owner

DavidRomanovizc commented May 2, 2023

Example code with try-except block covering the entire code block:

How not to do it

try:
    # some code here
except:
    print("Error occurred")

Example code with more accurate error handling:

How to do it right

# some code here
try:
    result = some_function() # function that we expect might raise an exception
except SomeSpecificError as e:
    # handle specific error
    logging.error(f"Error occurred: {e}")
except Exception as e:
    # handle any other unexpected errors
    logging.error(f"Unexpected error occurred: {e}")

It is necessary to check the entire code and correct where this occurs.

@DavidRomanovizc DavidRomanovizc added Type: Difficult a long problem and a difficult one Improve structure labels May 2, 2023
@DavidRomanovizc DavidRomanovizc added Priority: Low This issue can probably be picked up by anyone looking to contribute to the project, as an entry fix Status: Available No assigned owner for resolving this. Typically for bugs and enhancements, but can apply to others Status: Blocked Another prior issue or need for specific input to make progress. External blockers may also exist and removed Improve structure Status: Available No assigned owner for resolving this. Typically for bugs and enhancements, but can apply to others labels Aug 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Priority: Low This issue can probably be picked up by anyone looking to contribute to the project, as an entry fix Status: Blocked Another prior issue or need for specific input to make progress. External blockers may also exist Type: Difficult a long problem and a difficult one
Projects
None yet
Development

No branches or pull requests

1 participant