@@ -2374,39 +2374,30 @@ void FatalException(Isolate* isolate,
23742374 Local<Function> fatal_exception_function =
23752375 process_object->Get (fatal_exception_string).As <Function>();
23762376
2377- int exit_code = 0 ;
23782377 if (!fatal_exception_function->IsFunction ()) {
2379- // failed before the process._fatalException function was added!
2378+ // Failed before the process._fatalException function was added!
23802379 // this is probably pretty bad. Nothing to do but report and exit.
23812380 ReportException (env, error, message);
2382- exit_code = 6 ;
2383- }
2384-
2385- if (exit_code == 0 ) {
2381+ exit (6 );
2382+ } else {
23862383 TryCatch fatal_try_catch (isolate);
23872384
23882385 // Do not call FatalException when _fatalException handler throws
23892386 fatal_try_catch.SetVerbose (false );
23902387
2391- // this will return true if the JS layer handled it, false otherwise
2388+ // This will return true if the JS layer handled it, false otherwise
23922389 Local<Value> caught =
23932390 fatal_exception_function->Call (process_object, 1 , &error);
23942391
23952392 if (fatal_try_catch.HasCaught ()) {
2396- // the fatal exception function threw, so we must exit
2393+ // The fatal exception function threw, so we must exit
23972394 ReportException (env, fatal_try_catch);
2398- exit_code = 7 ;
2399- }
2400-
2401- if (exit_code == 0 && false == caught->BooleanValue ()) {
2395+ exit (7 );
2396+ } else if (caught->IsFalse ()) {
24022397 ReportException (env, error, message);
2403- exit_code = 1 ;
2398+ exit ( 1 ) ;
24042399 }
24052400 }
2406-
2407- if (exit_code) {
2408- exit (exit_code);
2409- }
24102401}
24112402
24122403
0 commit comments