t unexpected")
(C++11)  (  until C++17*  )  
[ set_unexpected  ](/w/cpp/error/set_unexpected "cpp/error/set unexpected") (
until C++17*  )  
Error codes  
[ Error codes ](/w/cpp/error/errno_macros "cpp/error/errno macros")  
[ errno  ](/w/cpp/error/errno "cpp/error/errno")  
  
|  Exception categories  
---  
[ logic_error  ](/w/cpp/error/logic_error "cpp/error/logic error")  
[ invalid_argument  ](/w/cpp/error/invalid_argument "cpp/error/invalid
argument")  
[ domain_error  ](/w/cpp/error/domain_error "cpp/error/domain error")  
[ length_error  ](/w/cpp/error/length_error "cpp/error/length error")  
[ out_of_range  ](/w/cpp/error/out_of_range "cpp/error/out of range")  
[ runtime_error  ](/w/cpp/error/runtime_error "cpp/error/runtime error")  
[ range_error  ](/w/cpp/error/range_error "cpp/error/range error")  
[ overflow_error  ](/w/cpp/error/overflow_error "cpp/error/overflow error")  
[ underflow_error  ](/w/cpp/error/underflow_error "cpp/error/underflow error")  
[ tx_exception  ](/w/cpp/error/tx_exception "cpp/error/tx exception") (TM TS)  
System error support  
[ error_category  ](/w/cpp/error/error_category "cpp/error/error category")
(C++11)  
[ generic_category  ](/w/cpp/error/generic_category "cpp/error/generic
category") (C++11)  
[ system_category  ](/w/cpp/error/system_category "cpp/error/system category")
(C++11)  
[ error_condition  ](/w/cpp/error/error_condition "cpp/error/error condition")
(C++11)  
[ errc  ](/w/cpp/error/errc "cpp/error/errc") (C++11)  
[ error_code  ](/w/cpp/error/error_code "cpp/error/error code") (C++11)  
[ system_error  ](/w/cpp/error/system_error "cpp/error/system error") (C++11)  
Assertions  
[ assert  ](/w/cpp/error/assert "cpp/error/assert")  
Stacktrace  
[ stacktrace_entry  ](/w/cpp/utility/stacktrace_entry "cpp/utility/stacktrace
entry") (C++23)  
[ basic_stacktrace  ](/w/cpp/utility/basic_stacktrace "cpp/utility/basic
stacktrace") (C++23)  
  
[ [edit]
](https://en.cppreference.com/mwiki/index.php?title=Template:cpp/error/navbar_content&action=edit)

##  Contents

  * 1  Exception handling 
    * 1.1  Capture and storage of exception objects 
    * 1.2  Handling of failures in exception handling 
    * 1.3  Handling of exception specification violations (removed in C++17) 
  * 2  Exception categories 
  * 3  Error numbers 
  * 4  System error 
  * 5  Assertions 
  * 6  Stacktrace 
  * 7  See also 

  
---  
  
###  [ [ edit ](/mwiki/index.php?title=cpp/error&action=edit&section=1 "Edit
section: Exception handling") ]  Exception handling

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

Defined in header ` [ <exception> ](/w/cpp/header/exception
"cpp/header/exception") `  
---  
[ exception  ](/w/cpp/error/exception "cpp/error/exception") |  base class for exceptions thrown by the standard library components   
(class)  [ [edit]
](https://en.cppreference.com/mwiki/index.php?title=Template:cpp/error/dsc_exception&action=edit)  
  
#####  Capture and storage of exception objects  
  
[ uncaught_exception  uncaught_exceptions  ](/w/cpp/error/uncaught_exception "cpp/error/uncaught exception") (removed in C++20)  (C++17)  |  checks if exception handling is currently in progress   
(function)  [ [edit]
](https://en.cppreference.com/mwiki/index.php?title=Template:cpp/error/dsc_uncaught_exception&action=edit)  
[ exception_ptr  ](/w/cpp/error/exception_ptr "cpp/error/exception ptr") (C++11)  |  shared pointer type for handling exception objects   
(typedef)  [ [edit]
](https://en.cppreference.com/mwiki/index.php?title=Template:cpp/error/dsc_exception_ptr&action=edit)  
[ make_exception_ptr  ](/w/cpp/error/make_exception_ptr "cpp/error/make exception ptr") (C++11)  |  creates an  [ std::exception_ptr ](/w/cpp/error/exception_ptr "cpp/error/exception ptr") from an exception object   
(function template)  [ [edit]
](https://en.cppreference.com/mwiki/index.php?title=Template:cpp/error/dsc_make_exception_ptr&action=edit)  
[ c