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>:
|unexpected|| Function handling unexpected exceptions (function)|
|terminate|| Function handling termination on exception (function)|