src: print error before aborting · nodejs/node@2755471 (original) (raw)
2 files changed
lines changed
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -14,10 +14,14 @@ | ||
14 | 14 | |
15 | 15 | namespace node { |
16 | 16 | |
17 | +using v8::Local; | |
18 | +using v8::Message; | |
19 | +using v8::Value; | |
20 | + | |
17 | 21 | enum ErrorHandlingMode { CONTEXTIFY_ERROR, FATAL_ERROR, MODULE_ERROR }; |
18 | 22 | void AppendExceptionLine(Environment* env, |
19 | -v8::Localv8::Value er, | |
20 | -v8::Localv8::Message message, | |
23 | + Local er, | |
24 | + Local message, | |
21 | 25 | enum ErrorHandlingMode mode); |
22 | 26 | |
23 | 27 | [[noreturn]] void FatalError(const char* location, const char* message); |
@@ -27,9 +31,13 @@ void PrintErrorString(const char* format, ...); | ||
27 | 31 | |
28 | 32 | void ReportException(Environment* env, const v8::TryCatch& try_catch); |
29 | 33 | |
34 | +void ReportException(Environment* env, | |
35 | + Local er, | |
36 | + Local message); | |
37 | + | |
30 | 38 | void FatalException(v8::Isolate* isolate, |
31 | -v8::Localv8::Value error, | |
32 | -v8::Localv8::Message message); | |
39 | + Local error, | |
40 | + Local message); | |
33 | 41 | |
34 | 42 | // Helpers to construct errors similar to the ones provided by |
35 | 43 | // lib/internal/errors.js. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -110,11 +110,12 @@ static void SetPromiseRejectCallback( | ||
110 | 110 | static void TriggerFatalException(const FunctionCallbackInfo& args) { |
111 | 111 | Isolate* isolate = args.GetIsolate(); |
112 | 112 | Environment* env = Environment::GetCurrent(isolate); |
113 | + Local exception = args[0]; | |
114 | + Local message = Exception::CreateMessage(isolate, exception); | |
113 | 115 | if (env != nullptr && env->abort_on_uncaught_exception()) { |
116 | +ReportException(env, exception, message); | |
114 | 117 | Abort(); |
115 | 118 | } |
116 | - Local exception = args[0]; | |
117 | - Local message = Exception::CreateMessage(isolate, exception); | |
118 | 119 | FatalException(isolate, exception, message); |
119 | 120 | } |
120 | 121 |