Code Yarns โ€๐Ÿ‘จโ€๐Ÿ’ป
Tech Blog โ– Personal Blog

Standard exceptions in C++

๐Ÿ“… 2014-Oct-09 โฌฉ โœ๏ธ Ashwin Nanjappa โฌฉ ๐Ÿท๏ธ cpp, exception, stdexcept โฌฉ ๐Ÿ“š Archive

All the standard exceptions in C++ are derived from the exception class that is defined in the exception header file. The standard exceptions are defined in the stdexcept header file.

The hierarchy of standard exceptions is shown below using an ASCII tree:

exception
โ”œโ”€โ”€ bad_alloc
โ”‚ย ย  โ””โ”€โ”€ bad_array_new_length
โ”œโ”€โ”€ bad_cast
โ”œโ”€โ”€ bad_exception
โ”œโ”€โ”€ bad_typeid
โ”œโ”€โ”€ logic_error
โ”‚ย ย  โ”œโ”€โ”€ domain_error
โ”‚ย ย  โ”œโ”€โ”€ future_error
โ”‚ย ย  โ”œโ”€โ”€ invalid_argument
โ”‚ย ย  โ”œโ”€โ”€ length_error
โ”‚ย ย  โ””โ”€โ”€ out_of_range
โ””โ”€โ”€ runtime_error
    โ”œโ”€โ”€ overflow_error
    โ”œโ”€โ”€ range_error
    โ”œโ”€โ”€ system_error
    โ”‚ย ย  โ””โ”€โ”€ ios_base::failure
    โ””โ”€โ”€ underflow_error

Reference: ยง30.4.1.1 in The C++ Programming Language (4 Ed) by Stroustrup


ยฉ 2022 Ashwin Nanjappa โ€ข All writing under CC BY-SA license โ€ข ๐Ÿ˜ @codeyarns@hachyderm.io โ€ข ๐Ÿ“ง