An error returned by an operating system or a language runtime, for example a file opening error. */
| 1382 | for example a file opening error. |
| 1383 | */ |
| 1384 | class SystemError : public internal::RuntimeError { |
| 1385 | private: |
| 1386 | void init(int error_code, StringRef format_str, ArgList args); |
| 1387 | |
| 1388 | protected: |
| 1389 | int error_code_; |
| 1390 | |
| 1391 | typedef char Char; // For FMT_VARIADIC_CTOR. |
| 1392 | |
| 1393 | SystemError() {} |
| 1394 | |
| 1395 | public: |
| 1396 | /** |
| 1397 | \rst |
| 1398 | Constructs a :cpp:class:`fmt::SystemError` object with the description |
| 1399 | of the form "*<message>*: *<system-message>*", where *<message>* is the |
| 1400 | formatted message and *<system-message>* is the system message corresponding |
| 1401 | to the error code. |
| 1402 | *error_code* is a system error code as given by ``errno``. |
| 1403 | \endrst |
| 1404 | */ |
| 1405 | SystemError(int error_code, StringRef message) { |
| 1406 | init(error_code, message, ArgList()); |
| 1407 | } |
| 1408 | FMT_VARIADIC_CTOR(SystemError, init, int, StringRef) |
| 1409 | |
| 1410 | int error_code() const { return error_code_; } |
| 1411 | }; |
| 1412 | |
| 1413 | /** |
| 1414 | \rst |