이름공간
변수
행위

Error handling

cppreference.com
< cpp
 
 
 
 

목차

[편집] Exception handling

The header <exception> provides several classes and functions related to exception handling in C++ programs.

<exception> 헤더에 정의되어 있음.
base class for exceptions thrown by the standard library components
(class) [edit]
Capture and storage of exception objects
checks if exception handling is currently in progress
(function) [edit]
shared pointer type for handling exception objects
(typedef) [edit]
creates an std::exception_ptr from an exception object
(function template) [edit]
captures the current exception in a std::exception_ptr
(function) [edit]
throws the exception from an std::exception_ptr
(function) [edit]
a mixin type to capture and store current exceptions
(class) [edit]
throws its argument with std::nested_exception mixed in
(function template) [edit]
throws the exception from a std::nested_exception
(function template) [edit]
Handling of failures in exception handling
function called when exception handling fails
(function) [edit]
the type of the function called by std::terminate
(typedef) [edit]
obtains the current terminate_handler
(function) [edit]
changes the function to be called by std::terminate
(function) [edit]
Handling of exception specification violations
(deprecated)
function called when dynamic exception specification is violated
(function) [edit]
exception thrown when dynamic exception specification is violated, if possible
(class) [edit]
the type of the function called by std::unexpected
(typedef) [edit]
(C++11)(deprecated)
obtains the current unexpected_handler
(function) [edit]
(deprecated)
changes the function to be called by std::unexpected
(function) [edit]

[편집] 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.

<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

<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]

[편집] Assertions

Assertions help to implement checking of preconditions in programs.

틀:dcl list end틀:dcl list begin
static assertion performs compile-time assertion checking (since C++11) [edit]
<cassert> 헤더에 정의되어 있음.
aborts the program if the user-specified condition is not true. May be disabled for release builds
(function macro) [edit]

[편집] 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.

<system_error> 헤더에 정의되어 있음.
base class for error categories
(class) [edit]
identifies the generic error category
(function) [edit]
identifies the operating system error category
(function) [edit]
holds a portable error code
(class) [edit]
(C++11)
the std::error_condition enumeration listing all standard <cerrno> macro constants
(class) [edit]
holds a platform-dependent error code
(class) [edit]
exception class used to report conditions that have an error_code
(class) [edit]