Skip to content

Commit

Permalink
fix: ignore "execution context was destroyed" error from puppeteer
Browse files Browse the repository at this point in the history
  • Loading branch information
DudaGod committed May 16, 2024
1 parent 4dd4b05 commit d52f2ca
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/utils/errors.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
const puppeteerErrMsgs = [/Cannot extract value when objectId is given/, /Execution context was destroyed/];

export const shouldIgnoreUnhandledRejection = (err: Error | undefined): boolean => {
if (!err) {
return false;
Expand All @@ -7,7 +9,7 @@ export const shouldIgnoreUnhandledRejection = (err: Error | undefined): boolean
return true;
}

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

Expand Down

0 comments on commit d52f2ca

Please sign in to comment.