acme
Foundational cross-platform layer of the ca2 framework
Toggle main menu visibility
Loading...
Searching...
No Matches
aaa_error.h
1
#pragma once
2
3
4
CLASS_DECL_ACME ::e_status get_last_status();
5
CLASS_DECL_ACME
void
set_last_status(const ::e_status & estatus);
6
7
9
class
c_error
10
{
11
public
:
12
13
inline
static ::u32 get_last_error()
14
{
15
16
return
errno;
17
18
}
19
20
inline
static
string
GetErrorDescription(::i32 iErrorCode = get_last_error())
21
{
22
23
return
strerror(iErrorCode);
24
25
}
26
27
};
28
29
30
#ifdef __WIN32
32
class
CLASS_DECL_ACME
sys_error
33
{
34
public
:
35
36
static ::u32 get_last_error() { return ::get_last_status(); }
37
38
static
string
GetErrorDescription(::i32 iErrorCode = get_last_error())
39
{
40
LPVOID pMsgBuf =
nullptr
;
41
42
format_message(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
43
nullptr
, iErrorCode, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
// Default language
44
reinterpret_cast<
char_pointer
>
(&pMsgBuf), 0,
nullptr
);
45
46
string
strErrorDescription;
47
if
(pMsgBuf)
48
49
{
50
strErrorDescription =
reinterpret_cast<
char_pointer
>
(pMsgBuf);
51
52
LocalFree(pMsgBuf);
53
54
}
55
return
strErrorDescription;
56
}
57
};
58
#else
59
60
class
CLASS_DECL_ACME
sys_error
:
public
c_error
61
{
62
public
:
63
64
};
65
66
#endif
67
68
c_error
Class with static functions to get information about an error.
Definition
aaa_error.h:10
sys_error
Definition
aaa_error.h:61
platform
aaa_error.h
Generated by
1.17.0