fix: improve formatting of error message in browser launch retries

This commit is contained in:
Nawaz Dhandala
2026-02-20 13:05:54 +00:00
parent f6d8761fe8
commit 006c41472c

View File

@@ -113,7 +113,11 @@ async function launchBrowser(
): Promise<{ browser: Browser; context: BrowserContext; page: Page }> {
let lastError: Error | undefined;
for (let attempt: number = 1; attempt <= MAX_BROWSER_LAUNCH_RETRIES; attempt++) {
for (
let attempt: number = 1;
attempt <= MAX_BROWSER_LAUNCH_RETRIES;
attempt++
) {
try {
return await launchBrowserOnce(config);
} catch (err: unknown) {
@@ -130,8 +134,8 @@ async function launchBrowser(
throw new Error(
`Failed to launch browser after ${MAX_BROWSER_LAUNCH_RETRIES} attempts. ` +
`This is usually caused by insufficient memory in the container. ` +
`Last error: ${lastError?.message || String(lastError)}`,
`This is usually caused by insufficient memory in the container. ` +
`Last error: ${lastError?.message || String(lastError)}`,
);
}