header
<exception>
Standard exceptions
This header defines the base class for all standard exceptions thrown by the elements of the standard library:
exception. It also defines the special exception
bad_exception.
It also provides elements to access the
unexpected and
terminatehandlers:
When an exception is thrown, its type is checked twice:
- First, if the function has an
exception-specification (a
throw specifier at the function signature), the type is checked against these. If the type does not match,
unexpected is called.
- Second, the exception type is checked against the exception handlers (
catch blocks). If it does not match at any nesting level,
terminate is called.
This header defines both
unexpected and
terminate along with functions to override their default behavior.
It also defines a function,
uncaught_exception that returns whether an exception has been thrown and not yet handled.
Contents of <exception>:
Classes:
- exception
- Standard exception class (class)
- bad_exception
- Exception thrown by handler unexpected (class)
Functions:
- set_unexpected
- Set unexpected handler function (function)
- unexpected
- Function handling unexpected exceptions (function)
- set_terminate
- Set terminate handler function (function)
- terminate
- Function handling termination on exception (function)
- uncaught_exception
- Return exception status (function)
Types:
- unexpected_handler
- Type of unexpected handler function (type)
- terminate_handler
- Type of terminate handler function (type)