Skip to content

Commit e779817

Browse files
committed
fix: ignore "execution context was destroyed" error from puppeteer
1 parent 0aff29a commit e779817

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/utils/errors.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
const puppeteerErrMsgs = [/Cannot extract value when objectId is given/, /Execution context was destroyed/];
2+
13
export const shouldIgnoreUnhandledRejection = (err: Error | undefined): boolean => {
24
if (!err) {
35
return false;
@@ -7,7 +9,7 @@ export const shouldIgnoreUnhandledRejection = (err: Error | undefined): boolean
79
return true;
810
}
911

10-
if (/Cannot extract value when objectId is given/.test(err.message) && err.stack?.includes("/puppeteer-core/")) {
12+
if (puppeteerErrMsgs.some(msg => msg.test(err.message)) && err.stack?.includes("/puppeteer-core/")) {
1113
return true;
1214
}
1315

0 commit comments

Comments
 (0)