Advertisement
Nenogzar

Built-in Exceptions

May 2nd, 2024
31
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.91 KB | None | 0 0
  1. BaseException
  2. +-- SystemExit # Raised by the sys.exit() function.
  3. +-- KeyboardInterrupt # Raised when the user hits the interrupt key (ctrl-c).
  4. +-- Exception # User-defined exceptions should be derived from this class.
  5. +-- ArithmeticError # Base class for arithmetic errors such as ZeroDivisionError.
  6. +-- AssertionError # Raised by `assert <exp>` if expression returns false value.
  7. +-- AttributeError # Raised when object doesn't have requested attribute/method.
  8. +-- EOFError # Raised by input() when it hits an end-of-file condition.
  9. +-- LookupError # Base class for errors when a collection can't find an item.
  10. | +-- IndexError # Raised when a sequence index is out of range.
  11. | +-- KeyError # Raised when a dictionary key or set element is missing.
  12. +-- MemoryError # Out of memory. May be too late to start deleting objects.
  13. +-- NameError # Raised when nonexistent name (variable/func/class) is used.
  14. | +-- UnboundLocalError # Raised when local name is used before it's being defined.
  15. +-- OSError # Errors such as FileExistsError/TimeoutError (see #Open).
  16. | +-- ConnectionError # Errors such as BrokenPipeError/ConnectionAbortedError.
  17. +-- RuntimeError # Raised by errors that don't fall into other categories.
  18. | +-- NotImplementedEr… # Can be raised by abstract methods or by unfinished code.
  19. | +-- RecursionError # Raised when the maximum recursion depth is exceeded.
  20. +-- StopIteration # Raised when an empty iterator is passed to next().
  21. +-- TypeError # When an argument of the wrong type is passed to function.
  22. +-- ValueError # When argument has the right type but inappropriate value.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement