All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
fmt::SystemError Class Reference

#include <format.h>

Public Member Functions

 SystemError (int error_code, CStringRef message)
int error_code () const

Protected Types

typedef char Char

Protected Member Functions

 SystemError ()
- Protected Member Functions inherited from fmt::internal::RuntimeError
 RuntimeError ()

Protected Attributes

int error_code_

Private Member Functions

void init (int err_code, CStringRef format_str, ArgList args)

Detailed Description

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

Member Typedef Documentation

typedef char fmt::SystemError::Char

Constructor & Destructor Documentation

fmt::SystemError::SystemError ( )
2156 {}
fmt::SystemError::SystemError ( int  error_code,
CStringRef  message 

Constructs a :class:fmt::SystemError object with the description of the form

.. parsed-literal:: <message>*: *<system-message>*

where *<message>* is the formatted message and *<system-message>* is the system message corresponding to the error code. error_code* is a system error code as given by errno. If error_code is not a valid error code such as -1, the system message may look like "Unknown error -1" and is platform-dependent.


This throws a SystemError 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::SystemError(errno, "cannot open file '{}'", filename);

2184  {
2185  init(error_code, message, ArgList());
2186  }
int error_code() const
Definition: format.h:2189
void init(int err_code, CStringRef format_str, ArgList args)

Member Function Documentation

int fmt::SystemError::error_code ( ) const
2189 { return error_code_; }
int error_code_
Definition: format.h:2152
void fmt::SystemError::init ( int  err_code,
CStringRef  format_str,
ArgList  args 

Member Data Documentation

int fmt::SystemError::error_code_

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