19 Diagnostics library [diagnostics]

19.5 System error support [syserr]

19.5.8 Class system_­error [syserr.syserr]

19.5.8.1 Overview [syserr.syserr.overview]

The class system_­error describes an exception object used to report error conditions that have an associated error code.
Such error conditions typically originate from the operating system or other low-level application program interfaces.
[Note 1:
If an error represents an out-of-memory condition, implementations are encouraged to throw an exception object of type bad_­alloc rather than system_­error.
— end note]
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; }; }