MCPcopy Create free account
hub / github.com/GaijinEntertainment/daScript / throw_fatal_error

Method throw_fatal_error

src/simulate/simulate_exceptions.cpp:22–61  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

20 }
21
22 void Context::throw_fatal_error ( const char * message, const LineInfo & at ) {
23 exceptionMessage = message ? message : "";
24 exceptionMessage += "\n";
25 exception = exceptionMessage.c_str();
26 exceptionAt = at;
27#if DAS_ENABLE_EXCEPTIONS
28 if ( alwaysErrorOnException ) {
29 to_err(&at, exception);
30 }
31 if ( alwaysStackWalkOnException ) {
32 stackWalkToErr(*this, at, showArgumentsOnException, showLocalVariablesOnException);
33 }
34 if ( breakOnException ) breakPoint(at, "exception", exception);
35 throw dasException(exception, at);
36#else
37 if ( throwBuf ) {
38 if ( alwaysErrorOnException ) {
39 to_err(&at, exception);
40 }
41 if ( alwaysStackWalkOnException ) {
42 stackWalkToErr(*this, at, showArgumentsOnException, showLocalVariablesOnException);
43 }
44 if ( breakOnException ) breakPoint(at, "exception", exception);
45#if defined(WIN64) || defined(_WIN64)
46 // "An invalid or unaligned stack was encountered during an unwind operation." exception is issued via longjmp
47 // this is a known issue with longjmp on x64, and this workaround disables stack unwinding
48 ((_JUMP_BUFFER *)throwBuf)->Frame = 0;
49#endif
50 longjmp(*throwBuf,1);
51 } else {
52 string msg = "\nunhandled exception\n" + exceptionAt.describe() + ": " + exception;
53 to_err(&at, msg.c_str());
54 stackWalkToErr(*this, at, showArgumentsOnException, showLocalVariablesOnException);
55 breakPoint(at, "exception", exception);
56 }
57#endif
58#if !defined(_MSC_VER) || (_MSC_VER>1900)
59 exit(0);
60#endif
61 }
62
63 void Context::rethrow () {
64#if DAS_ENABLE_EXCEPTIONS

Callers

nothing calls this directly

Calls 5

to_errFunction · 0.85
stackWalkToErrFunction · 0.85
dasExceptionClass · 0.85
c_strMethod · 0.45
describeMethod · 0.45

Tested by

no test coverage detected