> For the complete documentation index, see [llms.txt](https://suyashs-organization-3.gitbook.io/csitlabs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://suyashs-organization-3.gitbook.io/csitlabs/2nd_semester/oop/function_templates_exception.md).

# Standard Exceptions in C++

* There are some standard exceptions in C++ under <"exception"> which we can use in our programs.
* They are arranged in a parent-child class hierarchy which is depicted below:
  * std::exception - Parent class of all the standard C++ exceptions.
  * logic\_error - Exception happens in the internal logical of a program.
  * domain\_error - Exception due to use of invalid domain.
  * invalid argument - Exception due to invalid argument.
  * out\_of\_range - Exception due to out of range i.e. size requirement exceeds allocation.
  * length\_error - Exception due to length error.
  * runtime\_error - Exception happens during runtime.
  * range\_error - Exception due to range errors in internal computations.
  * overflow\_error - Exception due to arithmetic overflow errors.
  * underflow\_error - Exception due to arithmetic underflow errors
  * bad\_alloc - Exception happens when memory allocation with new() fails.
  * bad\_cast - Exception happens when dynamic cast fails.
  * bad\_exception - Exception is specially designed to be listed in the dynamic-exception-specifier.
  * bad\_typeid - Exception thrown by typeid.
