17 #ifndef __STOUT_WINDOWS_ERROR_HPP__ 18 #define __STOUT_WINDOWS_ERROR_HPP__ 33 :
Error(get_last_error_as_string(_code)), code(_code) {}
36 :
Error(message +
": " + get_last_error_as_string(_code)), code(_code) {}
39 static std::string get_last_error_as_string(
const DWORD error_code)
44 if (error_code == 0) {
48 const DWORD
flags = FORMAT_MESSAGE_ALLOCATE_BUFFER |
49 FORMAT_MESSAGE_FROM_SYSTEM |
50 FORMAT_MESSAGE_IGNORE_INSERTS;
52 const DWORD default_language = MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT);
85 char* message_buffer =
nullptr;
89 size_t size = ::FormatMessageA(
94 reinterpret_cast<char*>(&message_buffer),
98 std::string
message(message_buffer, size);
101 ::LocalFree(message_buffer);
137 #endif // __STOUT_WINDOWS_ERROR_HPP__ Definition: errorbase.hpp:36
Try< Bytes > size(const std::string &path, const FollowSymlink follow=FollowSymlink::FOLLOW_SYMLINK)
Definition: stat.hpp:130
WindowsErrorBase(DWORD _code, const std::string &message)
Definition: error.hpp:35
WindowsError(DWORD _code, const std::string &message)
Definition: error.hpp:118
WindowsSocketError()
Definition: error.hpp:126
Definition: error.hpp:123
Definition: error.hpp:108
WindowsError(DWORD _code)
Definition: error.hpp:113
const DWORD code
Definition: error.hpp:29
WindowsSocketError(DWORD _code)
Definition: error.hpp:128
WindowsSocketError(DWORD _code, const std::string &message)
Definition: error.hpp:133
WindowsSocketError(const std::string &message)
Definition: error.hpp:130
WindowsError()
Definition: error.hpp:111
const std::string message
Definition: errorbase.hpp:46
WindowsError(const std::string &message)
Definition: error.hpp:115
WindowsErrorBase(DWORD _code)
Definition: error.hpp:32