Windows apps
Collapse the table of content
Expand the table of content
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.



For the latest documentation on Visual Studio 2017 RC, see Visual Studio 2017 RC Documentation.

Defines several types and functions related to the handling of exceptions. Exception handling is used in situations in which the system can recover from an error. It provides a means for control to be returned from a function to the program. The objective of incorporating exception handling is to increase the program's robustness while providing a way to recover from an error in an orderly fashion.

#include <exception>  


exception_ptrA type that describes a pointer to an exception.
terminate_handlerA type that describes a pointer to a function suitable for use as a terminate_handler.
unexpected_handlerA type that describes a pointer to a function suitable for use as an unexpected_handler.


current_exceptionObtains a pointer to the current exception.
get_terminateObtains the current terminate_handler function.
get_unexpectedObtains the current unexpected_handler function.
make_exception_ptrCreates an exception_ptr object that holds a copy of an exception.
rethrow_exceptionThrows an exception passed as a parameter.
set_terminateEstablishes a new terminate_handler to be called at the termination of the program.
set_unexpectedEstablishes a new unexpected_handler to be when an unexpected exception is encountered.
terminateCalls a terminate handler.
uncaught_exceptionReturns true only if a thrown exception is being currently processed.
unexpectedCalls an unexpected handler.


bad_exception ClassThe class describes an exception that can be thrown from an unexpected_handler.
exception ClassThe class serves as the base class for all exceptions thrown by certain expressions and by the Standard C++ Library.

Header Files Reference
Thread Safety in the C++ Standard Library

© 2016 Microsoft