Lines Matching full:exceptions
4 Errors and Exceptions
9 distinguishable kinds of errors: *syntax errors* and *exceptions*.
34 .. _tut-exceptions:
36 Exceptions chapter
41 are called *exceptions* and are not unconditionally fatal: you will soon learn
42 how to handle them in Python programs. Most exceptions are not handled by
58 The last line of the error message indicates what happened. Exceptions come in
62 that occurred. This is true for all built-in exceptions, but need not be true
63 for user-defined exceptions (although it is a useful convention). Standard
74 :ref:`bltin-exceptions` lists the built-in exceptions and their meanings.
79 Handling Exceptions
82 It is possible to write programs that handle selected exceptions. Look at the
115 handlers for different exceptions. At most one handler will be executed.
116 Handlers only handle exceptions that occur in the corresponding *try clause*,
118 may name multiple exceptions as a parenthesized tuple, for example::
178 of the message for unhandled exceptions.
180 :exc:`BaseException` is the common base class of all exceptions. One of its
181 subclasses, :exc:`Exception`, is the base class of all the non-fatal exceptions.
182 Exceptions which are not subclasses of :exc:`Exception` are not typically
190 of exceptions that we intend to handle, and to allow any unexpected
191 exceptions to propagate on.
230 Exception handlers do not handle only exceptions that occur immediately in the
247 Raising Exceptions
312 This can be useful when you are transforming exceptions. For example::
345 For more information about chaining mechanics, see :ref:`bltin-exceptions`.
350 User-defined Exceptions
353 Programs may name their own exceptions by creating a new exception class (see
354 :ref:`tut-classes` for more about Python classes). Exceptions should typically
361 Most exceptions are defined with names that end in "Error", similar to the
362 naming of the standard exceptions.
364 Many standard modules define their own exceptions to report errors that may
404 :keyword:`continue` or :keyword:`return` statement, exceptions are not
495 Raising and Handling Multiple Unrelated Exceptions
498 There are situations where it is necessary to report several exceptions that
531 handle only the exceptions in the group that match a certain
533 group, each ``except*`` clause extracts from the group exceptions
534 of a certain type while letting all other exceptions propagate to
564 Note that the exceptions nested in an exception group must be instances,
565 not types. This is because in practice the exceptions would typically
581 Enriching Exceptions with Notes
587 purpose, exceptions have a method ``add_note(note)`` that accepts a string and
605 For example, when collecting exceptions into an exception group, we may want
623 | ExceptionGroup: We have some problems (3 sub-exceptions)