/error/get_unexpected "cpp/error/get unexpected") (C++11)  (removed in C++17)  |  obtains the current unexpected_handler   
(function)  [ [edit]
](https://en.cppreference.com/mwiki/index.php?title=Template:cpp/error/dsc_get_unexpected&action=edit)  
[ set_unexpected  ](/w/cpp/error/set_unexpected "cpp/error/set unexpected") (removed in C++17)  |  changes the function to be called by  [ std::unexpected ](/w/cpp/error/unexpected "cpp/error/unexpected")   
(function)  [ [edit]
](https://en.cppreference.com/mwiki/index.php?title=Template:cpp/error/dsc_set_unexpected&action=edit)  
  
###  [ [ edit ](/mwiki/index.php?title=cpp/error&action=edit&section=2 "Edit
section: Exception categories") ]  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 cannot easily be
predicted.

Defined in header ` [ <stdexcept> ](/w/cpp/header/stdexcept
"cpp/header/stdexcept") `  
---  
[ logic_error  ](/w/cpp/error/logic_error "cpp/error/logic error") |  exception class to indicate violations of logical preconditions or class invariants   
(class)  [ [edit]
](https://en.cppreference.com/mwiki/index.php?title=Template:cpp/error/inc_logic_error&action=edit)  
[ invalid_argument  ](/w/cpp/error/invalid_argument "cpp/error/invalid argument") |  exception class to report invalid arguments   
(class)  [ [edit]
](https://en.cppreference.com/mwiki/index.php?title=Template:cpp/error/inc_invalid_argument&action=edit)  
[ domain_error  ](/w/cpp/error/domain_error "cpp/error/domain error") |  exception class to report domain errors   
(class)  [ [edit]
](https://en.cppreference.com/mwiki/index.php?title=Template:cpp/error/inc_domain_error&action=edit)  
[ length_error  ](/w/cpp/error/length_error "cpp/error/length error") |  exception class to report attempts to exceed maximum allowed size   
(class)  [ [edit]
](https://en.cppreference.com/mwiki/index.php?title=Template:cpp/error/inc_length_error&action=edit)  
[ out_of_range  ](/w/cpp/error/out_of_range "cpp/error/out of range") |  exception class to report arguments outside of expected range   
(class)  [ [edit]
](https://en.cppreference.com/mwiki/index.php?title=Template:cpp/error/inc_out_of_range&action=edit)  
[ runtime_error  ](/w/cpp/error/runtime_error "cpp/error/runtime error") |  exception class to indicate conditions only detectable at run time   
(class)  [ [edit]
](https://en.cppreference.com/mwiki/index.php?title=Template:cpp/error/inc_runtime_error&action=edit)  
[ range_error  ](/w/cpp/error/range_error "cpp/error/range error") |  exception class to report range errors in internal computations   
(class)  [ [edit]
](https://en.cppreference.com/mwiki/index.php?title=Template:cpp/error/inc_range_error&action=edit)  
[ overflow_error  ](/w/cpp/error/overflow_error "cpp/error/overflow error") |  exception class to report arithmetic overflows   
(class)  [ [edit]
](https://en.cppreference.com/mwiki/index.php?title=Template:cpp/error/inc_overflow_error&action=edit)  
[ underflow_error  ](/w/cpp/error/underflow_error "cpp/error/underflow error") |  exception class to report arithmetic underflows   
(class)  [ [edit]
](https://en.cppreference.com/mwiki/index.php?title=Template:cpp/error/inc_underflow_error&action=edit)  
[ tx_exception  ](/w/cpp/error/tx_exception "cpp/error/tx exception") (TM TS)  |  exception class to cancel atomic transactions   
(class template)  
  
###  [ [ edit ](/mwiki/index.php?title=cpp/error&action=edit&section=3 "Edit
section: Error numbers") ]  Error numbers

Defined in header ` [ <cerrno> ](/w/cpp/header/cerrno "cpp/header/cerrno") `  
---  
[ errno  ](/w/cpp/error/errno "cpp/error/errno") |  macro which expands to POSIX-compatible thread-local error nu