Inspectopedia Help

Exceptions do not inherit from standard 'Exception' class

Reports cases when a custom exception class is raised but does not inherit from the builtin Exception class.

Example:

class A: pass def me_exception(): raise A()

The proposed quick-fix changes the code to:

class A(Exception): pass def me_exception(): raise A()

Inspection Details

Available in:

DataSpell 2023.3, PyCharm 2023.3

Plugin:

Python Community Edition, 233.SNAPSHOT

Last modified: 13 July 2023