@@ -2388,39 +2388,30 @@ void FatalException(Isolate* isolate,
2388
2388
Local<Function> fatal_exception_function =
2389
2389
process_object->Get (fatal_exception_string).As <Function>();
2390
2390
2391
- int exit_code = 0 ;
2392
2391
if (!fatal_exception_function->IsFunction ()) {
2393
- // failed before the process._fatalException function was added!
2392
+ // Failed before the process._fatalException function was added!
2394
2393
// this is probably pretty bad. Nothing to do but report and exit.
2395
2394
ReportException (env, error, message);
2396
- exit_code = 6 ;
2397
- }
2398
-
2399
- if (exit_code == 0 ) {
2395
+ exit (6 );
2396
+ } else {
2400
2397
TryCatch fatal_try_catch (isolate);
2401
2398
2402
2399
// Do not call FatalException when _fatalException handler throws
2403
2400
fatal_try_catch.SetVerbose (false );
2404
2401
2405
- // this will return true if the JS layer handled it, false otherwise
2402
+ // This will return true if the JS layer handled it, false otherwise
2406
2403
Local<Value> caught =
2407
2404
fatal_exception_function->Call (process_object, 1 , &error);
2408
2405
2409
2406
if (fatal_try_catch.HasCaught ()) {
2410
- // the fatal exception function threw, so we must exit
2407
+ // The fatal exception function threw, so we must exit
2411
2408
ReportException (env, fatal_try_catch);
2412
- exit_code = 7 ;
2413
- }
2414
-
2415
- if (exit_code == 0 && false == caught->BooleanValue ()) {
2409
+ exit (7 );
2410
+ } else if (caught->IsFalse ()) {
2416
2411
ReportException (env, error, message);
2417
- exit_code = 1 ;
2412
+ exit ( 1 ) ;
2418
2413
}
2419
2414
}
2420
-
2421
- if (exit_code) {
2422
- exit (exit_code);
2423
- }
2424
2415
}
2425
2416
2426
2417
0 commit comments