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`
37 When raising (or re-raising) an exception in an :keyword:`except` or
39 :attr:`__context__` is automatically set to the last exception caught; if the
40 new exception is not handled the traceback that is eventually displayed will
41 include the originating exception(s) and the final exception.
43 When raising a new exception (rather than using a bare ``raise`` to re-raise
44 the exception currently being handled), the implicit exception context can be
50 The expression following :keyword:`from` must be an exception or ``None``. It
51 will be set as :attr:`__cause__` on the raised exception. Setting
54 effectively replaces the old exception with the new one for display
56 leaving the old exception available in :attr:`__context__` for introspection
60 addition to the traceback for the exception itself. An explicitly chained
61 exception in :attr:`__cause__` is always shown when present. An implicitly
62 chained exception in :attr:`__context__` is shown only if :attr:`__cause__`
65 In either case, the exception itself is always shown after any chained
67 exception that was raised.
75 .. exception:: BaseException
78 inherited by user-defined classes (for that, use :exc:`Exception`). If
85 The tuple of arguments given to the exception constructor. Some built-in
92 This method sets *tb* as the new traceback for the exception and returns
93 the exception object. It is usually used in exception handling code like
103 .. exception:: Exception
109 .. exception:: ArithmeticError
116 .. exception:: BufferError
122 .. exception:: LookupError
134 .. exception:: AssertionError
141 .. exception:: AttributeError
148 .. exception:: EOFError
155 .. exception:: FloatingPointError
160 .. exception:: GeneratorExit
164 directly inherits from :exc:`BaseException` instead of :exc:`Exception` since
168 .. exception:: ImportError
177 the exception, respectively.
182 .. exception:: ModuleNotFoundError
191 .. exception:: IndexError
200 .. exception:: KeyError
207 .. exception:: KeyboardInterrupt
211 regularly. The exception inherits from :exc:`BaseException` so as to not be
212 accidentally caught by code that catches :exc:`Exception` and thus prevent
216 .. exception:: MemoryError
223 nevertheless raises an exception so that a stack traceback can be printed, in
227 .. exception:: NameError
234 .. exception:: NotImplementedError
236 This exception is derived from :exc:`RuntimeError`. In user defined base
237 classes, abstract methods should raise this exception when they require
253 .. exception:: OSError([arg])
258 This exception is raised when a system function returns a system-related
320 .. exception:: OverflowError
326 range. Because of the lack of standardization of floating point exception
330 .. exception:: RecursionError
332 This exception is derived from :exc:`RuntimeError`. It is raised when the
340 .. exception:: ReferenceError
342 This exception is raised when a weak reference proxy, created by the
348 .. exception:: RuntimeError
355 .. exception:: StopIteration
361 The exception object has a single attribute :attr:`value`, which is
362 given as an argument when constructing the exception, and defaults
368 :attr:`value` parameter to the constructor of the exception.
372 :exc:`StopIteration` as the new exception's cause).
386 .. exception:: StopAsyncIteration
393 .. exception:: SyntaxError
402 of the exception instance returns only the message.
405 .. exception:: IndentationError
411 .. exception:: TabError
417 .. exception:: SystemError
426 message (the exception's associated value) and if possible the source of the
430 .. exception:: SystemExit
432 This exception is raised by the :func:`sys.exit` function. It inherits from
433 :exc:`BaseException` instead of :exc:`Exception` so that it is not accidentally
434 caught by code that catches :exc:`Exception`. This allows the exception to
443 A call to :func:`sys.exit` is translated into an exception so that clean-up
456 .. exception:: TypeError
461 This exception may be raised by user code to indicate that an attempted
464 implementation, :exc:`NotImplementedError` is the proper exception to raise.
471 .. exception:: UnboundLocalError
478 .. exception:: UnicodeError
508 .. exception:: UnicodeEncodeError
514 .. exception:: UnicodeDecodeError
520 .. exception:: UnicodeTranslateError
526 .. exception:: ValueError
530 more precise exception such as :exc:`IndexError`.
533 .. exception:: ZeroDivisionError
543 .. exception:: EnvironmentError
545 .. exception:: IOError
547 .. exception:: WindowsError
558 .. exception:: BlockingIOError
574 .. exception:: ChildProcessError
579 .. exception:: ConnectionError
586 .. exception:: BrokenPipeError
593 .. exception:: ConnectionAbortedError
599 .. exception:: ConnectionRefusedError
605 .. exception:: ConnectionResetError
611 .. exception:: FileExistsError
616 .. exception:: FileNotFoundError
621 .. exception:: InterruptedError
628 signal, except if the signal handler raises an exception (see :pep:`475`
631 .. exception:: IsADirectoryError
637 .. exception:: NotADirectoryError
643 .. exception:: PermissionError
649 .. exception:: ProcessLookupError
654 .. exception:: TimeoutError
665 :pep:`3151` - Reworking the OS and IO exception hierarchy
676 .. exception:: Warning
681 .. exception:: UserWarning
686 .. exception:: DeprecationWarning
696 .. exception:: PendingDeprecationWarning
710 .. exception:: SyntaxWarning
715 .. exception:: RuntimeWarning
720 .. exception:: FutureWarning
726 .. exception:: ImportWarning
734 .. exception:: UnicodeWarning
739 .. exception:: BytesWarning
744 .. exception:: ResourceWarning
755 Exception hierarchy