blob: 882f69f9aad557fa09f74cf9fe241da4f805ec3d (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
// Copyright Epic Games, Inc. All Rights Reserved.
#include <zencore/except.h>
#include <system_error>
namespace zen {
void
ThrowSystemException([[maybe_unused]] HRESULT hRes, [[maybe_unused]] std::string_view Message)
{
if (HRESULT_FACILITY(hRes) == FACILITY_WIN32)
{
throw std::system_error(std::error_code(hRes & 0xffff, std::system_category()), std::string(Message));
}
else
{
throw WindowsException(hRes, Message);
}
}
void
ThrowLastError(std::string_view Message)
{
throw std::system_error(std::error_code(::GetLastError(), std::system_category()), std::string(Message));
}
} // namespace zen
|