Namespaces
Variants
Views
Actions

Difference between revisions of "cpp/error"

From cppreference.com
< cpp
m (one dcl list item template)
m (dcl item templates for system-error)
Line 72: Line 72:
 
{{dcl list header | system_error}}
 
{{dcl list header | system_error}}
 
{{dcl list template | cpp/error/system_error/dcl list error_category}}
 
{{dcl list template | cpp/error/system_error/dcl list error_category}}
{{dcl list class  | cpp/error/system_error/generic_category | error category indicating generic error| notes={{mark c++11}}}}
+
{{dcl list template | cpp/error/system_error/dcl list generic_category}}
{{dcl list class  | cpp/error/system_error/system_category | error category indicating the operating system as the source of error| notes={{mark c++11}}}}
+
{{dcl list template | cpp/error/system_error/dcl list system_category}}
  
{{dcl list class  | cpp/error/system_error/error_condition | identifies an error condition| notes={{mark c++11}}}}
+
{{dcl list template | cpp/error/system_error/dcl list error_condition}}
{{dcl list fun  | cpp/error/system_error/make_error_condition | creates an error condition object of specified error_category| notes={{mark c++11}}}}
+
{{dcl list template | cpp/error/system_error/dcl list make_error_condition}}
{{dcl list tclass  | cpp/error/system_error/is_error_condition_enum | identifies an enumeration as an {{cpp|std::error_condition}}| notes={{mark c++11}}}}
+
{{dcl list template | cpp/error/system_error/dcl list is_error_condition_enum}}
{{dcl list class  | cpp/error/system_error/err_c | the {{cpp|std::error_condition}} enumeration listing all standard {{tt|<cerrno>}} macro constants| notes={{mark c++11}}}}
+
{{dcl list template | cpp/error/system_error/dcl list err_c}}
  
{{dcl list class  | cpp/error/system_error/error_code | holds error code values| notes={{mark c++11}}}}
+
{{dcl list template | cpp/error/system_error/dcl list error_code}}
{{dcl list fun  | cpp/error/system_error/make_error_code | creates an error code from an error_category| notes={{mark c++11}}}}
+
{{dcl list template | cpp/error/system_error/dcl list make_error_code}}
{{dcl list tclass  | cpp/error/system_error/is_error_code_enum | identifies a class as an error_code enumeration| notes={{mark c++11}}}}
+
{{dcl list template | cpp/error/system_error/dcl list is_error_code_enum}}
  
{{dcl list class  | cpp/error/system_error/system_error | exception class used to report conditions that have an error_code| notes={{mark c++11}}}}
+
{{dcl list template | cpp/error/system_error/dcl list system_error}}
 
{{dcl list end}}
 
{{dcl list end}}

Revision as of 13:05, 10 January 2012

Template:cpp/error/sidebar

Contents

Exception handling

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

Template:cpp/error/exception/dcl list exceptionTemplate:cpp/error/exception/dcl list uncaught exceptionTemplate:cpp/error/exception/dcl list exception ptrTemplate:cpp/error/exception/dcl list make exception ptrTemplate:cpp/error/exception/dcl list current exceptionTemplate:cpp/error/exception/dcl list rethrow exceptionTemplate:cpp/error/exception/dcl list nested exceptionTemplate:cpp/error/exception/dcl list throw with nestedTemplate:cpp/error/exception/dcl list rethrow if nestedTemplate:cpp/error/exception/dcl list terminateTemplate:cpp/error/exception/dcl list terminate handlerTemplate:cpp/error/exception/dcl list get terminateTemplate:cpp/error/exception/dcl list set terminateTemplate:cpp/error/exception/dcl list unexpectedTemplate:cpp/error/exception/dcl list bad exceptionTemplate:cpp/error/exception/dcl list unexpected handlerTemplate:cpp/error/exception/dcl list get unexpectedTemplate:cpp/error/exception/dcl list set unexpected
Defined in header <exception>
Capture and storage of exception objects
Handling of failures in exception handling
Handling of exception specification violations

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)
macros for standard POSIX-compatible error conditions
(macro constant)

Assertions

Assertions help to implement checking of preconditions in programs.

Template:dcl list keyword
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.

Template:cpp/error/system error/dcl list error categoryTemplate:cpp/error/system error/dcl list generic categoryTemplate:cpp/error/system error/dcl list system categoryTemplate:cpp/error/system error/dcl list error conditionTemplate:cpp/error/system error/dcl list make error conditionTemplate:cpp/error/system error/dcl list is error condition enumTemplate:cpp/error/system error/dcl list err cTemplate:cpp/error/system error/dcl list error codeTemplate:cpp/error/system error/dcl list make error codeTemplate:cpp/error/system error/dcl list is error code enumTemplate:cpp/error/system error/dcl list system error
Defined in header <system_error>