Constructs std::system_error with a message formatted with fmt::format(fmt, args...). error_code is a system error code as given by errno.
Declared in <fmt/format.h>
template<typename... T>
std::system_error
system_error(
int error_code,
format_string<T...> fmt,
T&&... args);
Example:
// This throws std::system_error with the description // cannot open file 'madeup': No such file or directory // or similar (system message may vary). const char* filename = "madeup"; FILE* file = fopen(filename, "r"); if (!file) throw fmt::system_error(errno, "cannot open file '{}'", filename);
The constructed std::system_error.
| Name | Description |
|---|---|
| error_code | A system error code as given by errno. |
| fmt | The format string describing the error. |
| args | The arguments to format. |