File tree Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -46,9 +46,10 @@ export class ShipReaderWrapper {
4646 } ) ;
4747
4848 // handle unexpected error
49- error_types . forEach ( type => {
50- this . handleEvent ( type ) ;
51- } ) ;
49+ process . on ( 'unhandledRejection' , reason =>
50+ this . sendEventAndEndProcess ( 'unhandledRejection' , reason ) ,
51+ ) ;
52+ process . on ( 'uncaughtException' , err => this . sendEventAndEndProcess ( 'uncaughtException' , err ) ) ;
5253 }
5354
5455 /**
@@ -389,7 +390,12 @@ export class ShipReaderWrapper {
389390 resetEvent && ( await this . kafka_wrapper . sendEvent ( resetEvent , 'reset_event' ) ) ;
390391 await this . gracefulShutdown ( ) ;
391392 } finally {
392- process . kill ( process . pid , type ) ;
393+ const isSignal = signal_traps . includes ( type ) ;
394+ if ( isSignal ) {
395+ process . kill ( process . pid , type as NodeJS . Signals ) ;
396+ } else {
397+ process . exit ( 1 ) ;
398+ }
393399 }
394400 }
395401
You can’t perform that action at this time.
0 commit comments