It is commonly known that catching broad exceptions, such as Exception
in a try...except
block leads to issues around catching exceptions that should not have been caught and then are not handled correctly in the except
block. A related issue is encapsulating too much code in a try...except
block which can lead to catching exceptions on unexpected lines of code. This post provides an example where an except
block unexpectedly catches an exception and gives an example for how to avoid the issue.