MCPcopy Create free account
hub / github.com/HaxeFoundation/hxcpp / CriticalErrorHandler

Function CriticalErrorHandler

src/hx/Debug.cpp:75–110  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

73
74
75static void CriticalErrorHandler(String inErr, bool allowFixup)
76{
77#ifdef HXCPP_DEBUGGER
78 if (allowFixup && __hxcpp_dbg_fix_critical_error(inErr))
79 return;
80#endif
81
82#ifdef HXCPP_STACK_TRACE
83 hx::StackContext *ctx = hx::StackContext::getCurrent();
84 ctx->beginCatch(true);
85#endif
86
87 if (sCriticalErrorHandler!=null())
88 sCriticalErrorHandler(inErr);
89
90#ifdef HXCPP_STACK_TRACE
91 ctx->dumpExceptionStack();
92#endif
93
94 DBGLOG("Critical Error: %s\n", inErr.utf8_str());
95
96#if defined(HX_WINDOWS) && !defined(HX_WINRT)
97 MessageBoxA(0, inErr.utf8_str(), "Critical Error - program must terminate",
98 MB_ICONEXCLAMATION|MB_OK);
99#endif
100
101 // Good when using gdb, and to collect a core ...
102 #if __has_builtin(__builtin_trap)
103 __builtin_trap();
104 #else
105 (* (int *) 0) = 0;
106 #endif
107
108 // Just in case that didn't do it ...
109 exit(1);
110}
111
112void CriticalError(const String &inErr, bool inAllowFixup)
113{

Callers 1

CriticalErrorFunction · 0.85

Calls 5

beginCatchMethod · 0.80
dumpExceptionStackMethod · 0.80
utf8_strMethod · 0.80
nullClass · 0.50

Tested by

no test coverage detected