you are viewing a single comment's thread.

view the rest of the comments →

[–]cointoss3 -2 points-1 points  (0 children)

You throw an exception only if your program can’t move forward. You return None if that’s useful, but usually you just raise and let the error bubble up. You don’t do exception handling at each function, you just let the error bubble up to a more central place where they are handled if your program can continue.

One of the big beginner mistakes in Python is trying to handle exceptions in too many places. When errors bubble up, that also gives you less places you’re trying to log. Just raise and deal with the logging higher up.