forked from xNVSE/NVSE
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathIErrors.cpp
More file actions
59 lines (52 loc) · 1.58 KB
/
Copy pathIErrors.cpp
File metadata and controls
59 lines (52 loc) · 1.58 KB
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#include "common/IErrors.h"
#include "common/IDebugLog.h"
#include <cstdlib>
__declspec(noreturn) static void IErrors_Halt(void)
{
// crash
*((int *)0) = 0xDEADBEEF;
}
/**
* Report a failed assertion and exit the program
*
* @param file the file where the error occured
* @param line the line number where the error occured
* @param desc an error message
*/
void _AssertionFailed(const char * file, unsigned long line, const char * desc)
{
_FATALERROR("Assertion failed in %s (%d): %s", file, line, desc);
IErrors_Halt();
}
/**
* Report a failed assertion and exit the program
*
* @param file the file where the error occured
* @param line the line number where the error occured
* @param desc an error message
* @param code the error code
*/
void _AssertionFailed_ErrCode(const char * file, unsigned long line, const char * desc, unsigned long long code)
{
if(code & 0xFFFFFFFF00000000)
_FATALERROR("Assertion failed in %s (%d): %s (code = %16I64X (%I64d))", file, line, desc, code, code);
else
{
UInt32 code32 = code;
_FATALERROR("Assertion failed in %s (%d): %s (code = %08X (%d))", file, line, desc, code32, code32);
}
IErrors_Halt();
}
/**
* Report a failed assertion and exit the program
*
* @param file the file where the error occured
* @param line the line number where the error occured
* @param desc an error message
* @param code the error code
*/
void _AssertionFailed_ErrCode(const char * file, unsigned long line, const char * desc, const char * code)
{
_FATALERROR("Assertion failed in %s (%d): %s (code = %s)", file, line, desc, code);
IErrors_Halt();
}