Lines Matching full:exception
12 clause that mentions a particular class, that clause also handles any exception
13 classes derived from that class (but not exception classes from which *it* is
14 derived). Two exception classes that are not related via subclassing are never
23 code). The associated value is usually passed as arguments to the exception
26 User code can raise built-in exceptions. This can be used to test an exception
28 interpreter raises the same exception; but beware that there is nothing to
31 The built-in exception classes can be subclassed to define new exceptions;
32 programmers are encouraged to derive new exceptions from the :exc:`Exception`
38 Exception context
41 When raising a new exception while another exception
42 is already being handled, the new exception's
44 exception. An exception may be handled when an :keyword:`except` or
47 This implicit exception context can be
53 The expression following :keyword:`from<raise>` must be an exception or ``None``. It
54 will be set as :attr:`__cause__` on the raised exception. Setting
57 effectively replaces the old exception with the new one for display
59 leaving the old exception available in :attr:`__context__` for introspection
63 addition to the traceback for the exception itself. An explicitly chained
64 exception in :attr:`__cause__` is always shown when present. An implicitly
65 chained exception in :attr:`__context__` is shown only if :attr:`__cause__`
68 In either case, the exception itself is always shown after any chained
70 exception that was raised.
76 User code can create subclasses that inherit from an exception type.
77 It's recommended to only subclass one exception type at a time to avoid
86 multiple exception types. The memory layout of a type is an implementation
89 subclassing multiple exception types altogether.
97 .. exception:: BaseException
100 inherited by user-defined classes (for that, use :exc:`Exception`). If
107 The tuple of arguments given to the exception constructor. Some built-in
114 This method sets *tb* as the new traceback for the exception and returns
115 the exception object. It was more commonly used before the exception
130 .. exception:: Exception
136 .. exception:: ArithmeticError
143 .. exception:: BufferError
149 .. exception:: LookupError
161 .. exception:: AssertionError
168 .. exception:: AttributeError
182 .. exception:: EOFError
189 .. exception:: FloatingPointError
194 .. exception:: GeneratorExit
198 directly inherits from :exc:`BaseException` instead of :exc:`Exception` since
202 .. exception:: ImportError
211 the exception, respectively.
216 .. exception:: ModuleNotFoundError
225 .. exception:: IndexError
234 .. exception:: KeyError
241 .. exception:: KeyboardInterrupt
245 regularly. The exception inherits from :exc:`BaseException` so as to not be
246 accidentally caught by code that catches :exc:`Exception` and thus prevent
250 .. exception:: MemoryError
257 nevertheless raises an exception so that a stack traceback can be printed, in
261 .. exception:: NameError
275 .. exception:: NotImplementedError
277 This exception is derived from :exc:`RuntimeError`. In user defined base
278 classes, abstract methods should raise this exception when they require
294 .. exception:: OSError([arg])
299 This exception is raised when a system function returns a system-related
361 .. exception:: OverflowError
367 range. Because of the lack of standardization of floating point exception
371 .. exception:: RecursionError
373 This exception is derived from :exc:`RuntimeError`. It is raised when the
381 .. exception:: ReferenceError
383 This exception is raised when a weak reference proxy, created by the
389 .. exception:: RuntimeError
396 .. exception:: StopIteration
402 The exception object has a single attribute :attr:`value`, which is
403 given as an argument when constructing the exception, and defaults
409 :attr:`value` parameter to the constructor of the exception.
413 :exc:`StopIteration` as the new exception's cause).
427 .. exception:: StopAsyncIteration
434 .. exception:: SyntaxError(message, details)
442 The :func:`str` of the exception instance returns only the error message.
481 .. exception:: IndentationError
487 .. exception:: TabError
493 .. exception:: SystemError
502 message (the exception's associated value) and if possible the source of the
506 .. exception:: SystemExit
508 This exception is raised by the :func:`sys.exit` function. It inherits from
509 :exc:`BaseException` instead of :exc:`Exception` so that it is not accidentally
510 caught by code that catches :exc:`Exception`. This allows the exception to
519 A call to :func:`sys.exit` is translated into an exception so that clean-up
532 .. exception:: TypeError
537 This exception may be raised by user code to indicate that an attempted
540 implementation, :exc:`NotImplementedError` is the proper exception to raise.
547 .. exception:: UnboundLocalError
554 .. exception:: UnicodeError
584 .. exception:: UnicodeEncodeError
590 .. exception:: UnicodeDecodeError
596 .. exception:: UnicodeTranslateError
602 .. exception:: ValueError
606 more precise exception such as :exc:`IndexError`.
609 .. exception:: ZeroDivisionError
619 .. exception:: EnvironmentError
621 .. exception:: IOError
623 .. exception:: WindowsError
634 .. exception:: BlockingIOError
650 .. exception:: ChildProcessError
655 .. exception:: ConnectionError
662 .. exception:: BrokenPipeError
669 .. exception:: ConnectionAbortedError
675 .. exception:: ConnectionRefusedError
681 .. exception:: ConnectionResetError
687 .. exception:: FileExistsError
692 .. exception:: FileNotFoundError
697 .. exception:: InterruptedError
704 signal, except if the signal handler raises an exception (see :pep:`475`
707 .. exception:: IsADirectoryError
713 .. exception:: NotADirectoryError
721 .. exception:: PermissionError
727 .. exception:: ProcessLookupError
732 .. exception:: TimeoutError
743 :pep:`3151` - Reworking the OS and IO exception hierarchy
754 .. exception:: Warning
759 .. exception:: UserWarning
764 .. exception:: DeprecationWarning
776 .. exception:: PendingDeprecationWarning
792 .. exception:: SyntaxWarning
797 .. exception:: RuntimeWarning
802 .. exception:: FutureWarning
808 .. exception:: ImportWarning
816 .. exception:: UnicodeWarning
821 .. exception:: EncodingWarning
830 .. exception:: BytesWarning
835 .. exception:: ResourceWarning
846 Exception hierarchy