Unhandled exceptions checking

David wizzardx at gmail.com
Sat May 24 05:54:11 EDT 2008


On Sat, May 24, 2008 at 3:31 AM, Yosifov Pavel <aquagnu at gmail.com> wrote:
> Does somebody know existent tool for checking unhandled exceptions?
> Like in Java when method throws exception but in code using this
> method, try...catch is missed. May be something like PyChecker?
>

Python is too dynamic to do this reliably. eg:

e = exception_returning_func()
raise e

You'll probably be better served by capturing and logging all
unhandled exceptions in your app ("logger.exception(e)" works nicely
in a high level "catch Exception e" block), and then notifying users.

Another thing to try is coverage testing. Won't raise all possible
exceptions in a given  piece of code, but at least you can check if
all lines get run once.

David.



More information about the Python-list mailing list