From d52f2caba28ae5b6eb9a8fff6bf847093476dbf1 Mon Sep 17 00:00:00 2001 From: DudaGod Date: Thu, 16 May 2024 16:35:57 +0300 Subject: [PATCH] fix: ignore "execution context was destroyed" error from puppeteer --- src/utils/errors.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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; }