File tree Expand file tree Collapse file tree 3 files changed +19
-2
lines changed Expand file tree Collapse file tree 3 files changed +19
-2
lines changed Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ const info = require("./info");
99const Hermione = require ( "../hermione" ) ;
1010const pkg = require ( "../../package.json" ) ;
1111const logger = require ( "../utils/logger" ) ;
12+ const { shouldIgnoreUnhandledRejection } = require ( "../utils/errors" ) ;
1213
1314let hermione ;
1415
@@ -18,7 +19,7 @@ process.on("uncaughtException", err => {
1819} ) ;
1920
2021process . on ( "unhandledRejection" , ( reason , p ) => {
21- if ( reason && reason . name === "ProtocolError" ) {
22+ if ( shouldIgnoreUnhandledRejection ( reason ) ) {
2223 logger . warn ( `Unhandled Rejection "${ reason } " in hermione:master:${ process . pid } was ignored` ) ;
2324 return ;
2425 }
Original file line number Diff line number Diff line change 1+ export const shouldIgnoreUnhandledRejection = ( err : Error | undefined ) : boolean => {
2+ if ( ! err ) {
3+ return false ;
4+ }
5+
6+ if ( err . name === "ProtocolError" ) {
7+ return true ;
8+ }
9+
10+ if ( / C a n n o t e x t r a c t v a l u e w h e n o b j e c t I d i s g i v e n / . test ( err . message ) && err . stack ?. includes ( "/puppeteer-core/" ) ) {
11+ return true ;
12+ }
13+
14+ return false ;
15+ } ;
Original file line number Diff line number Diff line change @@ -4,9 +4,10 @@ const _ = require("lodash");
44const { WORKER_UNHANDLED_REJECTION } = require ( "../constants/process-messages" ) ;
55const logger = require ( "./logger" ) ;
66const ipc = require ( "./ipc" ) ;
7+ const { shouldIgnoreUnhandledRejection } = require ( "./errors" ) ;
78
89process . on ( "unhandledRejection" , ( reason , p ) => {
9- if ( reason && reason . name === "ProtocolError" ) {
10+ if ( shouldIgnoreUnhandledRejection ( reason ) ) {
1011 logger . warn ( `Unhandled Rejection "${ reason } " in hermione:worker:${ process . pid } was ignored` ) ;
1112 return ;
1213 }
You can’t perform that action at this time.
0 commit comments