diff --git a/src/utils/errors.ts b/src/utils/errors.ts index ebd55bdea..ea190a5f4 100644 --- a/src/utils/errors.ts +++ b/src/utils/errors.ts @@ -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; @@ -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; }