diff options
author | Ruben Bridgewater <ruben@bridgewater.de> | 2018-04-25 17:50:43 +0200 |
---|---|---|
committer | Anna Henningsen <anna@addaleax.net> | 2018-04-27 20:22:26 +0200 |
commit | b87ef189e91e475ca4811addc3f4201641f8789b (patch) | |
tree | 2205b81992b5455bf0ca5302eda17889eaba0f3c /src | |
parent | 2b8512738aa14bfa157f010eee198c123b4d8b14 (diff) | |
download | android-node-v8-b87ef189e91e475ca4811addc3f4201641f8789b.tar.gz android-node-v8-b87ef189e91e475ca4811addc3f4201641f8789b.tar.bz2 android-node-v8-b87ef189e91e475ca4811addc3f4201641f8789b.zip |
src: improve fatal exception
This is just some code cleanup.
PR-URL: https://github.com/nodejs/node/pull/20294
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/node.cc | 25 |
1 files changed, 8 insertions, 17 deletions
diff --git a/src/node.cc b/src/node.cc index d8c0bded38..ee114257d5 100644 --- a/src/node.cc +++ b/src/node.cc @@ -2374,39 +2374,30 @@ void FatalException(Isolate* isolate, Local<Function> fatal_exception_function = process_object->Get(fatal_exception_string).As<Function>(); - int exit_code = 0; if (!fatal_exception_function->IsFunction()) { - // failed before the process._fatalException function was added! + // Failed before the process._fatalException function was added! // this is probably pretty bad. Nothing to do but report and exit. ReportException(env, error, message); - exit_code = 6; - } - - if (exit_code == 0) { + exit(6); + } else { TryCatch fatal_try_catch(isolate); // Do not call FatalException when _fatalException handler throws fatal_try_catch.SetVerbose(false); - // this will return true if the JS layer handled it, false otherwise + // This will return true if the JS layer handled it, false otherwise Local<Value> caught = fatal_exception_function->Call(process_object, 1, &error); if (fatal_try_catch.HasCaught()) { - // the fatal exception function threw, so we must exit + // The fatal exception function threw, so we must exit ReportException(env, fatal_try_catch); - exit_code = 7; - } - - if (exit_code == 0 && false == caught->BooleanValue()) { + exit(7); + } else if (caught->IsFalse()) { ReportException(env, error, message); - exit_code = 1; + exit(1); } } - - if (exit_code) { - exit(exit_code); - } } |