Difference between revisions of "cpp/error"
From cppreference.com
< cpp
(now I think errno macros should be an actual page, not a "macro const") |
m (get_terminate only in c++11, and so is get_unexpected) |
||
Line 20: | Line 20: | ||
{{dcl list fun | cpp/error/exception/terminate | function called when exception handling fails}} | {{dcl list fun | cpp/error/exception/terminate | function called when exception handling fails}} | ||
{{dcl list typedef | cpp/error/exception/terminate_handler | the type of the function called by {{cpp|std::terminate}}}} | {{dcl list typedef | cpp/error/exception/terminate_handler | the type of the function called by {{cpp|std::terminate}}}} | ||
− | {{dcl list fun | cpp/error/exception/get_terminate | obtains the current terminate_handler}} | + | {{dcl list fun | cpp/error/exception/get_terminate | obtains the current terminate_handler | notes={{mark c++11}}}} |
{{dcl list fun | cpp/error/exception/set_terminate | changes the function to be called by {{cpp|std::terminate}} }} | {{dcl list fun | cpp/error/exception/set_terminate | changes the function to be called by {{cpp|std::terminate}} }} | ||
{{dcl list h2 | Handling of exception specification violations}} | {{dcl list h2 | Handling of exception specification violations}} | ||
Line 26: | Line 26: | ||
{{dcl list class | cpp/error/exception/bad_exception | notes={{mark deprecated}} | exception thrown when dynamic exception specification is violated, if possible}} | {{dcl list class | cpp/error/exception/bad_exception | notes={{mark deprecated}} | exception thrown when dynamic exception specification is violated, if possible}} | ||
{{dcl list typedef | cpp/error/exception/unexpected_handler | notes={{mark deprecated}} | the type of the function called by {{cpp|std::unexpected}} }} | {{dcl list typedef | cpp/error/exception/unexpected_handler | notes={{mark deprecated}} | the type of the function called by {{cpp|std::unexpected}} }} | ||
− | {{dcl list fun | cpp/error/exception/get_unexpected | notes={{mark deprecated}} | obtains the current unexpected_handler}} | + | {{dcl list fun | cpp/error/exception/get_unexpected | notes={{mark c++11}}{{mark deprecated}} | obtains the current unexpected_handler}} |
{{dcl list fun | cpp/error/exception/set_unexpected | notes={{mark deprecated}} | changes the function to be called by {{cpp|std::unexpected}}}} | {{dcl list fun | cpp/error/exception/set_unexpected | notes={{mark deprecated}} | changes the function to be called by {{cpp|std::unexpected}}}} | ||
{{dcl list end}} | {{dcl list end}} |
Revision as of 07:32, 4 November 2011
Contents |
Exception handling
The header <exception>
provide 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 | |
(C++11) |
checks if exception handling is currently in progress (function) |
(C++11) |
shared pointer type for handling exception objects (typedef) |
(C++11) |
creates an Template:cpp from an exception object (function template) |
(C++11) |
captures the current exception in a Template:cpp (function) |
(C++11) |
throws the exception from an Template:cpp (function) |
(C++11) |
a mixin type to capture and store current exceptions (class) |
(C++11) |
throws its argument with Template:cpp mixed in (function template) |
(C++11) |
throws the exception from a Template:cpp (function template) |
Handling of failures in exception handling | |
function called when exception handling fails (function) | |
the type of the function called by Template:cpp (typedef) | |
(C++11) |
obtains the current terminate_handler (function) |
changes the function to be called by Template:cpp (function) | |
Handling of exception specification violations | |
(deprecated) |
function called when dynamic exception specification is violated (function) |
(deprecated) |
exception thrown when dynamic exception specification is violated, if possible (class) |
(deprecated) |
the type of the function called by Template:cpp (typedef) |
(C++11)(deprecated) |
obtains the current unexpected_handler (function) |
(deprecated) |
changes the function to be called by Template:cpp (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) |
Error numbers
Defined in header
<cerrno> | |
macro which expands to POSIX-compatible thread-local error number variable (macro constant) |
Assertions
Assertions help to implement checking of preconditions in programs.
Defined in header
<cassert> | |
aborts the program if the user-specified condition is not Template:cpp. 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, Template:cpp, or other low-level APIs.
Defined in header
<system_error> | |
(C++11) |
base class for error categories (class) |
(C++11) |
error category indicating generic error (class) |
(C++11) |
error category indicating the operating system as the source of error (class) |
(C++11) |
identifies an error condition (class) |
(C++11) |
creates an error condition object of specified error_category (function) |
(C++11) |
identifies an enumeration as an Template:cpp (class template) |
(C++11) |
the Template:cpp enumeration listing all standard <cerrno> macro constants (class) |
(C++11) |
holds error code values (class) |
(C++11) |
creates an error code from an error_category (function) |
(C++11) |
identifies a class as an error_code enumeration (class template) |
(C++11) |
exception class used to report conditions that have an error_code (class) |