Skip to content
This repository was archived by the owner on Dec 1, 2023. It is now read-only.

Commit ae4482c

Browse files
catch uncaught exceptions & rejections.
1 parent f4ea15a commit ae4482c

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/process-helper.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@ export class ProcessHelper extends Messenger {
6666

6767
this.childProcess.on('exit', this.autoRestartListener);
6868
this.childProcess.on('error', this.errorHandler);
69+
this.childProcess.on('uncaughtException', this.errorHandler);
70+
this.childProcess.on('unhandledRejection', this.errorHandler);
6971
}
7072

7173
this.connect(this.childProcess);
@@ -80,6 +82,8 @@ export class ProcessHelper extends Messenger {
8082

8183
this.childProcess.off('exit', this.autoRestartListener!);
8284
this.childProcess.off('error', this.errorHandler);
85+
this.childProcess.off('uncaughtException', this.errorHandler);
86+
this.childProcess.off('unhandledRejection', this.errorHandler);
8387
this.autoRestartListener = undefined;
8488

8589
this.childProcess.kill('SIGTERM');

0 commit comments

Comments
 (0)