diff options
author | John Ankarström <john@ankarstrom.se> | 2022-08-22 03:17:54 +0200 |
---|---|---|
committer | John Ankarström <john@ankarstrom.se> | 2022-08-22 03:21:52 +0200 |
commit | d7bb04a09c7f04b0c3a8580d6a9ccd6313656fcf (patch) | |
tree | 46f91cf658a39015d821d19935b6f99867ddbfed /c/win.h | |
parent | ba0750ff48bcf97ef99602fe27322fa706a93b6b (diff) | |
download | EpisodeBrowser-d7bb04a09c7f04b0c3a8580d6a9ccd6313656fcf.tar.gz |
Add InternetError exception.
Diffstat (limited to 'c/win.h')
-rw-r--r-- | c/win.h | 26 |
1 files changed, 22 insertions, 4 deletions
@@ -16,14 +16,32 @@ int GetRelativeCursorPos(HWND hWnd, POINT* pt) noexcept; /* Cached values from GetSystemMetrics. */ template <int I> auto Metric = GetSystemMetrics(I); +struct WideException : public std::exception +{ + virtual const char* what() const noexcept = 0; + virtual const wchar_t* What() const noexcept = 0; +}; + /* Exception for Windows API errors. */ -struct Win32Error : public std::exception +struct Win32Error : public WideException { - Win32Error() noexcept; - Win32Error(DWORD code) noexcept; + Win32Error(DWORD code = GetLastError()) noexcept; ~Win32Error() noexcept; const char* what() const noexcept override; - const wchar_t* What() const noexcept; + const wchar_t* What() const noexcept override; + DWORD code; +private: + char* m_szMsg = nullptr; + wchar_t* m_wszMsg = nullptr; +}; + +/* Exception for extended Wininet errors. */ +struct InternetError : public WideException +{ + InternetError(DWORD codeSystem = GetLastError()); + ~InternetError() noexcept; + const char* what() const noexcept override; + const wchar_t* What() const noexcept override; DWORD code; private: char* m_szMsg = nullptr; |