[std.exceptions.general]

# 19 Diagnostics library [[diagnostics]](./#diagnostics)

## 19.2 Exception classes [[std.exceptions]](std.exceptions#general)

### 19.2.1 General [std.exceptions.general]

[1](#1)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L31)

The C++ standard library provides classes to be used to report certain errors ([[res.on.exception.handling]](res.on.exception.handling "16.4.6.14 Restrictions on exception handling")) in
C++ programs[.](#1.sentence-1)

In the error model reflected in these classes, errors are divided into two
broad categories:[*logic*](#def:logic) errors and[*runtime*](#def:runtime) errors[.](#1.sentence-2)

[2](#2)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L41)

The distinguishing characteristic of logic errors is that they are due to errors
in the internal logic of the program[.](#2.sentence-1)

In theory, they are preventable[.](#2.sentence-2)

[3](#3)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L46)

By contrast, runtime errors are due to events beyond the scope of the program[.](#3.sentence-1)

They cannot be easily predicted in advance[.](#3.sentence-2)

The header <stdexcept> defines several types of predefined exceptions for reporting errors in a C++ program[.](#3.sentence-3)

These exceptions are related by inheritance[.](#3.sentence-4)
