[syserr.syserr.overview]

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

## 19.5 System error support [[syserr]](syserr#syserr.overview)

### 19.5.8 Class system_error [[syserr.syserr]](syserr.syserr#overview)

#### 19.5.8.1 Overview [syserr.syserr.overview]

[1](#1)

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

The class system_error describes an exception object used to
report error conditions that have an associated error code[.](#1.sentence-1)

Such error
conditions typically originate from the operating system or other low-level
application program interfaces[.](#1.sentence-2)

[2](#2)

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

[*Note [1](#note-1)*:

If an error represents an out-of-memory condition, implementations are
encouraged to throw an exception object of type [bad_alloc](bad.alloc "17.6.4.1 Class bad_­alloc [bad.alloc]") rather
than system_error[.](#2.sentence-1)

â *end note*]

[ð](#lib:system_error)

namespace std {class system_error : public runtime_error {public: system_error(error_code ec, const string& what_arg);
 system_error(error_code ec, const char* what_arg);
 system_error(error_code ec);
 system_error(int ev, const error_category& ecat, const string& what_arg);
 system_error(int ev, const error_category& ecat, const char* what_arg);
 system_error(int ev, const error_category& ecat); const error_code& code() const noexcept; const char* what() const noexcept override; };}
