Could I get a list of all python errors?: How (are there any built in functions) and where (a website maybe) could I do this?
-
1What's the use case for this?Tomos Williams– Tomos Williams2018-02-20 17:07:29 +00:00Commented Feb 20, 2018 at 17:07
-
2This post shows zero effort or research on your part.dfundako– dfundako2018-02-20 17:08:58 +00:00Commented Feb 20, 2018 at 17:08
-
1How about the doc?Right leg– Right leg2018-02-20 17:14:20 +00:00Commented Feb 20, 2018 at 17:14
Add a comment
|
1 Answer
As expected, the official documentation has the answer.
On this page, you'll find the base exceptions, and the concrete exceptions as well, sorted by category. You'll find at section 5.4. Exception hierarchy an inheritance tree displaying the hierarchy between built-in exceptions.
The most interesting point certainly is that every exception extends BaseException, and that a custom exception should in most cases inherit from Exception.
Here is the exceptions hierarchy tree:
BaseException
+-- SystemExit
+-- KeyboardInterrupt
+-- GeneratorExit
+-- Exception
+-- StopIteration
+-- StopAsyncIteration
+-- ArithmeticError
| +-- FloatingPointError
| +-- OverflowError
| +-- ZeroDivisionError
+-- AssertionError
+-- AttributeError
+-- BufferError
+-- EOFError
+-- ImportError
| +-- ModuleNotFoundError
+-- LookupError
| +-- IndexError
| +-- KeyError
+-- MemoryError
+-- NameError
| +-- UnboundLocalError
+-- OSError
| +-- BlockingIOError
| +-- ChildProcessError
| +-- ConnectionError
| | +-- BrokenPipeError
| | +-- ConnectionAbortedError
| | +-- ConnectionRefusedError
| | +-- ConnectionResetError
| +-- FileExistsError
| +-- FileNotFoundError
| +-- InterruptedError
| +-- IsADirectoryError
| +-- NotADirectoryError
| +-- PermissionError
| +-- ProcessLookupError
| +-- TimeoutError
+-- ReferenceError
+-- RuntimeError
| +-- NotImplementedError
| +-- RecursionError
+-- SyntaxError
| +-- IndentationError
| +-- TabError
+-- SystemError
+-- TypeError
+-- ValueError
| +-- UnicodeError
| +-- UnicodeDecodeError
| +-- UnicodeEncodeError
| +-- UnicodeTranslateError
+-- Warning
+-- DeprecationWarning
+-- PendingDeprecationWarning
+-- RuntimeWarning
+-- SyntaxWarning
+-- UserWarning
+-- FutureWarning
+-- ImportWarning
+-- UnicodeWarning
+-- BytesWarning
+-- ResourceWarning