MemotivaCommon pitfalls and best practices

Why should you avoid catching all exceptions?

Common pitfalls and best practices

Audio flashcard · 0:14

Nortren·

Why should you avoid catching all exceptions?

0:14

Catching all exceptions hides bugs by silently handling unexpected errors. It also catches programming mistakes like name errors and type errors that should crash loudly. Catch only the specific exceptions you can meaningfully handle, and let everything else propagate.
docs.python.org