Skip to content

Commit 48fa7ad

Browse files
committed
chore: give playwright errors more context
1 parent 4667a8d commit 48fa7ad

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/features/website.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,21 @@ export async function getWebsiteData(browser: Browser, url: string, timeoutForDo
3131
if (!!failure) {
3232
// 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`)
3333
if (failure.errorText.startsWith('net::')) {
34-
const errorToThrow = new Error(`an error comes from the processing of Playwright`);
34+
const errorToThrow = new Error(
35+
`an error comes from the processing of Playwright for "${request.url()}" (which may just be an assert url when loading)`
36+
);
3537

3638
errorToThrow.cause = {
3739
code: failure.errorText,
3840
};
3941

4042
errorWithDetailsIntoListener = errorToThrow;
41-
} else errorWithDetailsIntoListener = new Error(`an error comes from the processing of Playwright: ${failure.errorText}`);
43+
} else
44+
errorWithDetailsIntoListener = new Error(
45+
`an error comes from the processing of Playwright for "${request.url()}" (which may just be an assert url when loading): ${
46+
failure.errorText
47+
}`
48+
);
4249
}
4350
});
4451

0 commit comments

Comments
 (0)