Clementine
Public Member Functions | Protected Attributes | List of all members
system_error Class Reference

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

#include <format.h>

Inheritance diagram for system_error:
Inheritance graph
[legend]
Collaboration diagram for system_error:
Collaboration graph
[legend]

Public Member Functions

template<typename... Args>
 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. More...
 
 system_error (const system_error &)=default
 
system_erroroperator= (const system_error &)=default
 
 system_error (system_error &&)=default
 
system_erroroperator= (system_error &&)=default
 
int error_code () const
 

Protected Attributes

int error_code_
 

Detailed Description

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

Constructor & Destructor Documentation

◆ system_error()

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

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.

Example**::

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);


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