Difference between revisions of "cpp/error"
From cppreference.com
< cpp
(+tx_exception (here because TS puts it in <stdexcept>)) |
m (s/class/tclass) |
||
Line 48: | Line 48: | ||
{{dsc class | cpp/error/overflow_error | exception class to report arithmetic overflows}} | {{dsc class | cpp/error/overflow_error | exception class to report arithmetic overflows}} | ||
{{dsc class | cpp/error/underflow_error | exception class to report arithmetic underflows}} | {{dsc class | cpp/error/underflow_error | exception class to report arithmetic underflows}} | ||
− | {{dsc | + | {{dsc tclass | cpp/error/tx_exception | exception class to cancel atomic transacations|notes={{mark since tm ts}}}} |
{{dsc end}} | {{dsc end}} | ||
Revision as of 10:39, 18 May 2016
Contents |
Exception handling
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) | |
Capture and storage of exception objects | |
(removed in C++20*)(C++17) |
checks if exception handling is currently in progress (function) |
(C++11) |
shared pointer type for handling exception objects (typedef) |
(C++11) |
creates an std::exception_ptr from an exception object (function template) |
(C++11) |
captures the current exception in a std::exception_ptr (function) |
(C++11) |
throws the exception from an std::exception_ptr (function) |
(C++11) |
a mixin type to capture and store current exceptions (class) |
(C++11) |
throws its argument with std::nested_exception mixed in (function template) |
(C++11) |
throws the exception from a std::nested_exception (function template) |
Defined in header
<exception_list> | |
Handling of failures in exception handling | |
Defined in header
<exception> | |
function called when exception handling fails (function) | |
the type of the function called by std::terminate (typedef) | |
(C++11) |
obtains the current terminate_handler (function) |
changes the function to be called by std::terminate (function) | |
Handling of exception specification violations | |
(deprecated in C++11)(removed in C++17) |
function called when dynamic exception specification is violated (function) |
exception thrown when std::current_exception fails to copy the exception object (class) | |
(deprecated in C++11)(removed in C++17) |
the type of the function called by std::unexpected (typedef) |
(deprecated in C++11)(removed in C++17) |
obtains the current unexpected_handler (function) |
(deprecated in C++11)(removed in C++17) |
changes the function to be called by std::unexpected (function) |
Exception categories
Several convenience classes are predefined in the header <stdexcept>
to report particular error conditions. These classes can be divided into two categories: logic errors and runtime 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 can not be easily predicted.
Defined in header
<stdexcept> | |
exception class to indicate violations of logical preconditions or class invariants (class) | |
exception class to report invalid arguments (class) | |
exception class to report domain errors (class) | |
exception class to report attempts to exceed maximum allowed size (class) | |
exception class to report arguments outside of expected range (class) | |
exception class to indicate conditions only detectable at run time (class) | |
exception class to report range errors in internal computations (class) | |
exception class to report arithmetic overflows (class) | |
exception class to report arithmetic underflows (class) | |
(TM TS) |
exception class to cancel atomic transacations (class template) |
Error numbers
Defined in header
<cerrno> | |
macro which expands to POSIX-compatible thread-local error number variable (macro variable) | |
macros for standard POSIX-compatible error conditions (macro constant) |
Assertions
Assertions help to implement checking of preconditions in programs.
static_assert declaration (C++11)
|
performs compile-time assertion checking |
Defined in header
<cassert> | |
aborts the program if the user-specified condition is not true. May be disabled for release builds. (function macro) |
System error
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) |
(C++11) |
identifies the generic error category (function) |
(C++11) |
identifies the operating system error category (function) |
(C++11) |
holds a portable error code (class) |
(C++11) |
the std::error_condition enumeration listing all standard <cerrno> macro constants (class) |
(C++11) |
holds a platform-dependent error code (class) |
(C++11) |
exception class used to report conditions that have an error_code (class) |
See also
C documentation for Error handling
|