17 #ifndef __STOUT_WINDOWS_ERROR_HPP__
18 #define __STOUT_WINDOWS_ERROR_HPP__
35 :
Error(get_last_error_as_string(_code)),
code(_code) {}
38 :
Error(message +
": " + get_last_error_as_string(_code)),
code(_code) {}
41 static std::string get_last_error_as_string(DWORD errorCode)
48 DWORD allocate_message_buffer =
49 FORMAT_MESSAGE_ALLOCATE_BUFFER |
50 FORMAT_MESSAGE_FROM_SYSTEM |
51 FORMAT_MESSAGE_IGNORE_INSERTS;
53 DWORD default_language = MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT);
86 wchar_t *message_buffer =
nullptr;
87 size_t size = ::FormatMessageW(
88 allocate_message_buffer,
92 (LPWSTR)&message_buffer,
96 std::wstring
message(message_buffer, size);
99 ::LocalFree(message_buffer);
133 #endif // __STOUT_WINDOWS_ERROR_HPP__
Definition: errorbase.hpp:35
Try< Bytes > size(const std::string &path, const FollowSymlink follow=FollowSymlink::FOLLOW_SYMLINK)
Definition: stat.hpp:100
WindowsErrorBase(DWORD _code, const std::string &message)
Definition: error.hpp:37
WindowsError(DWORD _code, const std::string &message)
Definition: error.hpp:115
WindowsSocketError()
Definition: error.hpp:122
Definition: error.hpp:120
Definition: error.hpp:106
WindowsError(DWORD _code)
Definition: error.hpp:110
const DWORD code
Definition: error.hpp:31
WindowsSocketError(DWORD _code)
Definition: error.hpp:124
WindowsSocketError(DWORD _code, const std::string &message)
Definition: error.hpp:129
WindowsSocketError(const std::string &message)
Definition: error.hpp:126
WindowsError()
Definition: error.hpp:108
const std::string message
Definition: errorbase.hpp:45
WindowsError(const std::string &message)
Definition: error.hpp:112
WindowsErrorBase(DWORD _code)
Definition: error.hpp:34
std::string stringify(int flags)