MCPcopy Create free account
hub / github.com/ObEngine/ObEngine / windows_error

Class windows_error

extlibs/fmt/include/fmt/os.h:162–199  ·  view source on GitHub ↗

A Windows error. */

Source from the content-addressed store, hash-verified

160
161/** A Windows error. */
162class windows_error : public system_error {
163 private:
164 FMT_API void init(int error_code, string_view format_str, format_args args);
165
166 public:
167 /**
168 \rst
169 Constructs a :class:`fmt::windows_error` object with the description
170 of the form
171
172 .. parsed-literal::
173 *<message>*: *<system-message>*
174
175 where *<message>* is the formatted message and *<system-message>* is the
176 system message corresponding to the error code.
177 *error_code* is a Windows error code as given by ``GetLastError``.
178 If *error_code* is not a valid error code such as -1, the system message
179 will look like "error -1".
180
181 **Example**::
182
183 // This throws a windows_error with the description
184 // cannot open file 'madeup': The system cannot find the file specified.
185 // or similar (system message may vary).
186 const char *filename = "madeup";
187 LPOFSTRUCT of = LPOFSTRUCT();
188 HFILE file = OpenFile(filename, &of, OF_READ);
189 if (file == HFILE_ERROR) {
190 throw fmt::windows_error(GetLastError(),
191 "cannot open file '{}'", filename);
192 }
193 \endrst
194 */
195 template <typename... Args>
196 windows_error(int error_code, string_view message, const Args&... args) {
197 init(error_code, message, make_format_args(args...));
198 }
199};
200
201// Reports a Windows error without throwing an exception.
202// Can be used to report errors from destructors.

Callers 2

utf16_to_utf8Method · 0.85
sizeMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected