pylint-errors

E0712 (catching-non-exception)

:x: Problematic code:

class FooError:
    pass


try:
    1 / 0
except FooError:
    pass

:heavy_check_mark: Correct code:

class FooError(Exception):
    pass


try:
    1 / 0
except FooError:
    pass

Rationale:

Used when a class which doesn’t inherit from Exception is used as an exception in an except clause.