#include <format.h>
Public Member Functions | |
template<typename... Args> | |
system_error (int error_code, string_view message, const Args &... args) | |
system_error (const system_error &)=default | |
system_error & | operator= (const system_error &)=default |
system_error (system_error &&)=default | |
system_error & | operator= (system_error &&)=default |
~system_error () FMT_NOEXCEPT FMT_OVERRIDE | |
int | error_code () const |
Protected Member Functions | |
system_error () | |
Protected Attributes | |
int | error_code_ |
Private Member Functions | |
void | init (int err_code, string_view format_str, format_args args) |
An error returned by an operating system or a language runtime, for example a file opening error.
|
protected |
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
.
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);
Definition at line 2731 of file format.h.
References FMT_NOEXCEPT, FMT_OVERRIDE, and make_format_args().
|
default |
|
default |
|
default |
Referenced by internal::decimal_point_impl().
int error_code | ( | ) | const |
Definition at line 2741 of file format.h.
References FMT_API, FMT_NOEXCEPT, format_system_error(), make_format_args(), and report_system_error().
|
private |
Definition at line 233 of file format-inl.h.
References format_system_error(), to_string(), and internal::vformat().
|
default |
|
default |