All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
system_error Class Reference

#include <format.h>

+ Inheritance diagram for system_error:

Public Member Functions

template<typename... Args>
 system_error (int error_code, string_view message, const Args &...args)
int error_code () const

Protected Member Functions

 system_error ()

Protected Attributes

int error_code_

Detailed Description

An error returned by an operating system or a language runtime, for example a file opening error.

Definition at line 2337 of file format.h.

Constructor & Destructor Documentation

system_error::system_error ( )

Definition at line 2344 of file format.h.

template<typename... Args>
system_error::system_error ( int  error_code,
string_view  message,
const Args &...  args 

Constructs a :class:fmt::system_error object with a description formatted with fmt::format_system_error. message and additional arguments passed into the constructor are formatted similarly to fmt::format.


This throws a system_error with the description cannot open file 'madeup': No such file or directory or similar (system message may vary). const char *filename = "madeup"; std::FILE *file = std::fopen(filename, "r"); if (!file) throw fmt::system_error(errno, "cannot open file '{}'", filename);

Definition at line 2366 of file format.h.

Member Function Documentation

int system_error::error_code ( ) const

Definition at line 2371 of file format.h.

Member Data Documentation

int system_error::error_code_

Definition at line 2342 of file format.h.

The documentation for this class was generated from the following files: