acme
Foundational cross-platform layer of the ca2 framework
Toggle main menu visibility
Loading...
Searching...
No Matches
hresult_exception.h
1
#pragma once
2
3
4
#include "acme/exception/exception.h"
5
#include "acme/_operating_system.h"
6
7
8
class
CLASS_DECL_ACME hresult_exception :
9
public
::exception
10
{
11
public
:
12
13
14
hresult_exception(HRESULT hresult, const_char_pointer pszMessage =
nullptr
);
15
~hresult_exception()
override
;
16
17
18
};
19
20
21
inline ::string hresult_text(HRESULT hresult)
22
{
23
24
return ::windows::last_error_message((DWORD)hresult);
25
26
}
27
28
29
inline
void
defer_throw_hresult(HRESULT hresult)
30
{
31
32
if
(FAILED(hresult))
33
{
34
35
throw
hresult_exception
(hresult);
36
37
}
38
39
}
40
41
42
inline
error_code
hresult_error_code(HRESULT hresult)
43
{
44
45
return
{ e_error_code_type_hresult, (::i64)hresult };
46
47
}
48
49
50
51
CLASS_DECL_ACME ::string hresult_to_string(HRESULT hr);
52
error_code
Definition
error_code.h:22
hresult_exception
Definition
hresult_exception.h:10
operating_system
windows_common
com
hresult_exception.h
Generated by
1.17.0