Difference between revisions of "cpp/error"
From cppreference.com
< cpp
m (r2.7.3) (Robot: Adding de, es, fr, it, ja, pt, ru, zh) |
m (Shorten template names. Use {{lc}} where appropriate.) |
||
Line 5: | Line 5: | ||
The header {{tt|<exception>}} provides several classes and functions related to exception handling in C++ programs. | The header {{tt|<exception>}} provides several classes and functions related to exception handling in C++ programs. | ||
− | {{ | + | {{dsc begin}} |
− | {{ | + | {{dsc header | exception}} |
− | {{ | + | {{dsc inc | cpp/error/dcl list exception}} |
− | {{ | + | {{dsc h2 | Capture and storage of exception objects}} |
− | {{ | + | {{dsc inc | cpp/error/dcl list uncaught_exception}} |
− | {{ | + | {{dsc inc | cpp/error/dcl list exception_ptr}} |
− | {{ | + | {{dsc inc | cpp/error/dcl list make_exception_ptr}} |
− | {{ | + | {{dsc inc | cpp/error/dcl list current_exception}} |
− | {{ | + | {{dsc inc | cpp/error/dcl list rethrow_exception}} |
− | {{ | + | {{dsc inc | cpp/error/dcl list nested_exception}} |
− | {{ | + | {{dsc inc | cpp/error/dcl list throw_with_nested}} |
− | {{ | + | {{dsc inc | cpp/error/dcl list rethrow_if_nested}} |
− | {{ | + | {{dsc h2 | Handling of failures in exception handling}} |
− | {{ | + | {{dsc inc | cpp/error/dcl list terminate}} |
− | {{ | + | {{dsc inc | cpp/error/dcl list terminate_handler}} |
− | {{ | + | {{dsc inc | cpp/error/dcl list get_terminate}} |
− | {{ | + | {{dsc inc | cpp/error/dcl list set_terminate}} |
− | {{ | + | {{dsc h2 | Handling of exception specification violations}} |
− | {{ | + | {{dsc inc | cpp/error/dcl list unexpected}} |
− | {{ | + | {{dsc inc | cpp/error/dcl list bad_exception}} |
− | {{ | + | {{dsc inc | cpp/error/dcl list unexpected_handler}} |
− | {{ | + | {{dsc inc | cpp/error/dcl list get_unexpected}} |
− | {{ | + | {{dsc inc | cpp/error/dcl list set_unexpected}} |
− | {{ | + | {{dsc end}} |
====Exception categories==== | ====Exception categories==== | ||
Line 34: | Line 34: | ||
Several convenience classes are predefined in the header {{tt|<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. | Several convenience classes are predefined in the header {{tt|<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. | ||
− | {{ | + | {{dsc begin}} |
− | {{ | + | {{dsc header | stdexcept}} |
− | {{ | + | {{dsc class | cpp/error/logic_error | exception class to indicate violations of logical preconditions or class invariants}} |
− | {{ | + | {{dsc class | cpp/error/invalid_argument | exception class to report invalid arguments}} |
− | {{ | + | {{dsc class | cpp/error/domain_error | exception class to report domain errors}} |
− | {{ | + | {{dsc class | cpp/error/length_error | exception class to report attempts to exceed maximum allowed size}} |
− | {{ | + | {{dsc class | cpp/error/out_of_range | exception class to report arguments outside of expected range}} |
− | {{ | + | {{dsc class | cpp/error/runtime_error | exception class to indicate conditions only detectable at run time}} |
− | {{ | + | {{dsc class | cpp/error/range_error | exception class to report range errors in internal computations}} |
− | {{ | + | {{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 end}} |
===Error numbers=== | ===Error numbers=== | ||
− | {{ | + | {{dsc begin}} |
− | {{ | + | {{dsc header | cerrno}} |
− | {{ | + | {{dsc inc | cpp/error/dcl list errno}} |
− | {{ | + | {{dsc inc | cpp/error/dcl list errno_macros}} |
− | {{ | + | {{dsc end}} |
===Assertions=== | ===Assertions=== | ||
Line 59: | Line 59: | ||
Assertions help to implement checking of preconditions in programs. | Assertions help to implement checking of preconditions in programs. | ||
− | {{ | + | {{dsc begin}} |
− | {{ | + | {{dsc inc | cpp/language/dcl list static_assert}} |
− | {{ | + | {{dsc break}} |
− | {{ | + | {{dsc header | cassert}} |
− | {{ | + | {{dsc inc | cpp/error/dcl list assert}} |
− | {{ | + | {{dsc end}} |
===System error=== | ===System error=== | ||
− | The header {{tt|<system_error>}} defines types and functions used to report error conditions originating from the operating system, streams I/O, {{ | + | The header {{tt|<system_error>}} defines types and functions used to report error conditions originating from the operating system, streams I/O, {{lc|std::future}}, or other low-level APIs. |
− | {{ | + | {{dsc begin}} |
− | {{ | + | {{dsc header | system_error}} |
− | {{ | + | {{dsc inc | cpp/error/dcl list error_category}} |
− | {{ | + | {{dsc inc | cpp/error/dcl list generic_category}} |
− | {{ | + | {{dsc inc | cpp/error/dcl list system_category}} |
− | {{ | + | {{dsc inc | cpp/error/dcl list error_condition}} |
− | {{ | + | {{dsc inc | cpp/error/dcl list errc}} |
− | {{ | + | {{dsc inc | cpp/error/dcl list error_code}} |
− | {{ | + | {{dsc inc | cpp/error/dcl list system_error}} |
− | {{ | + | {{dsc end}} |
[[de:cpp/error]] | [[de:cpp/error]] |
Revision as of 18:41, 31 May 2013
Contents |
Exception handling
The header <exception>
provides several classes and functions related to exception handling in C++ programs.
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> |
Assertions
Assertions help to implement checking of preconditions in programs.
Defined in header
<cassert> |
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.