.. _broad-exception-caught: broad-exception-caught / W0718 ============================== **Message emitted:** ``Catching too general exception %s`` **Description:** *If you use a naked ``except Exception:`` clause, you might end up catching exceptions other than the ones you expect to catch. This can hide bugs or make it harder to debug programs when unrelated errors are hidden.* **Problematic code:** .. literalinclude:: /data/messages/b/broad-exception-caught/bad.py :language: python **Correct code:** .. literalinclude:: /data/messages/b/broad-exception-caught/good.py :language: python **Additional details:** For example, you're trying to import a library with required system dependencies and you catch everything instead of only import errors, you will miss the error message telling you, that your code could work if you had installed the system dependencies. **Related links:** - `Should I always specify an exception type in 'except' statements? `_ Created by the `exceptions `__ checker.