From 48fa7ad2edff15452504898a6a3aad20fd5231df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Rame=CC=81?= Date: Mon, 26 Feb 2024 02:01:39 +0100 Subject: [PATCH] chore: give playwright errors more context --- src/features/website.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/features/website.ts b/src/features/website.ts index 907a115..ae0e243 100644 --- a/src/features/website.ts +++ b/src/features/website.ts @@ -31,14 +31,21 @@ export async function getWebsiteData(browser: Browser, url: string, timeoutForDo if (!!failure) { // Mimic errors format we can have we other network libraries to factorize the handling logic since here it's just pure "useless" text (have a look at `src/utils/request.ts`) if (failure.errorText.startsWith('net::')) { - const errorToThrow = new Error(`an error comes from the processing of Playwright`); + const errorToThrow = new Error( + `an error comes from the processing of Playwright for "${request.url()}" (which may just be an assert url when loading)` + ); errorToThrow.cause = { code: failure.errorText, }; errorWithDetailsIntoListener = errorToThrow; - } else errorWithDetailsIntoListener = new Error(`an error comes from the processing of Playwright: ${failure.errorText}`); + } else + errorWithDetailsIntoListener = new Error( + `an error comes from the processing of Playwright for "${request.url()}" (which may just be an assert url when loading): ${ + failure.errorText + }` + ); } });