|
|
Contents |
The header<exception> provides several classes and functions related to exception handling in C++ programs.
Defined in header <exception> | |
base class for exceptions thrown by the standard library components (class)[edit] | |
Capture and storage of exception objects | |
(removed in C++20*)(C++17) | checks if exception handling is currently in progress (function)[edit] |
(C++11) | shared pointer type for handling exception objects (typedef)[edit] |
(C++11) | creates anstd::exception_ptr from an exception object (function template)[edit] |
(C++11) | captures the current exception in astd::exception_ptr (function)[edit] |
(C++11) | throws the exception from anstd::exception_ptr (function)[edit] |
(C++11) | a mixin type to capture and store current exceptions (class)[edit] |
(C++11) | throws its argument withstd::nested_exception mixed in (function template)[edit] |
(C++11) | throws the exception from astd::nested_exception (function template)[edit] |
Handling of failures in exception handling | |
Defined in header <exception> | |
function called when exception handling fails (function)[edit] | |
the type of the function called bystd::terminate (typedef)[edit] | |
(C++11) | obtains the current terminate_handler (function)[edit] |
changes the function to be called bystd::terminate (function)[edit] | |
exception thrown whenstd::current_exception fails to copy the exception object (class)[edit] | |
Handling of exception specification violations(until C++17) | |
(deprecated in C++11)(removed in C++17) | function called when dynamic exception specification is violated (function)[edit] |
(deprecated in C++11)(removed in C++17) | the type of the function called bystd::unexpected (typedef)[edit] |
(deprecated in C++11)(removed in C++17) | obtains the currentunexpected_handler (function)[edit] |
(deprecated in C++11)(removed in C++17) | changes the function to be called bystd::unexpected (function)[edit] |
Several convenience classes are predefined in the header<stdexcept>
to report particular error conditions. These classes can be divided into two categories:logic errors andruntime errors. Logic errors are a consequence of faulty logic within the program and may be preventable. Runtime errors are due to events beyond the scope of the program and cannot easily be predicted.
Defined in header <stdexcept> | |
exception class to indicate violations of logical preconditions or class invariants (class)[edit] | |
exception class to report invalid arguments (class)[edit] | |
exception class to report domain errors (class)[edit] | |
exception class to report attempts to exceed maximum allowed size (class)[edit] | |
exception class to report arguments outside of expected range (class)[edit] | |
exception class to indicate conditions only detectable at run time (class)[edit] | |
exception class to report range errors in internal computations (class)[edit] | |
exception class to report arithmetic overflows (class)[edit] | |
exception class to report arithmetic underflows (class)[edit] | |
(TM TS) | exception class to cancel atomic transactions (class template) |
Defined in header <cerrno> | |
macro which expands to POSIX-compatible thread-local error number variable (macro variable)[edit] | |
macros for standard POSIX-compatible error conditions (macro constant)[edit] |
The header<system_error>
defines types and functions used to report error conditions originating from the operating system, streams I/O,std::future, or other low-level APIs.
Defined in header <system_error> | |
(C++11) | base class for error categories (class)[edit] |
(C++11) | identifies the generic error category (function)[edit] |
(C++11) | identifies the operating system error category (function)[edit] |
(C++11) | holds a portable error code (class)[edit] |
(C++11) | thestd::error_condition enumeration listing all standard<cerrno> macro constants (class)[edit] |
(C++11) | holds a platform-dependent error code (class)[edit] |
(C++11) | exception class used to report conditions that have an error_code (class)[edit] |
Assertions help to implement checking of preconditions in programs.
Defined in header <cassert> | |
aborts the program if the user-specified condition is nottrue. May be disabled for release builds. (function macro)[edit] |
Defined in header <stacktrace> | |
(C++23) | representation of an evaluation in a stacktrace (class)[edit] |
(C++23) | approximate representation of an invocation sequence consists of stacktrace entries (class template)[edit] |
Defined in header <debugging> | |
(C++26) | pauses the running program when called (function)[edit] |
(C++26) | callsstd::breakpoint ifstd::is_debugger_present returnstrue (function)[edit] |
(C++26) | checks whether a program is running under the control of a debugger (function)[edit] |
static_assert declaration(C++11) | performs compile-time assertion checking[edit] |
C documentation forError handling |