From 5ce5fc0e20dfc4a98e7fcff24faec36fdb81a4fb Mon Sep 17 00:00:00 2001 From: Simon Knott Date: Fri, 29 Nov 2024 12:31:33 +0100 Subject: [PATCH] simplify logging --- .../src/server/registry/browserFetcher.ts | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/packages/playwright-core/src/server/registry/browserFetcher.ts b/packages/playwright-core/src/server/registry/browserFetcher.ts index cd8d0d2630..3eb021956c 100644 --- a/packages/playwright-core/src/server/registry/browserFetcher.ts +++ b/packages/playwright-core/src/server/registry/browserFetcher.ts @@ -159,24 +159,20 @@ async function downloadBrotli(title: string, browserDirectory: string, url: stri tarFs.extract(browserDirectory) ); } catch (error) { - if (error?.code === 'ECONNRESET') { - debugLogger.log('install', `-- download failed, server closed connection`); + if (error?.code === 'ECONNRESET') throw new Error(`Download failed: server closed connection. URL: ${url}`); - } - debugLogger.log('install', `-- download failed, unexpected error`); throw new Error(`Download failed: ${error?.message ?? error}. URL: ${url}`); } - if (downloadedBytes !== totalBytes) { - debugLogger.log('install', `-- download failed, size mismatch: ${downloadedBytes} != ${totalBytes}`); + if (downloadedBytes !== totalBytes) throw new Error(`Download failed: size mismatch, file size: ${downloadedBytes}, expected size: ${totalBytes} URL: ${url}`); - } debugLogger.log('install', `-- download complete, size: ${downloadedBytes}`); return { error: null }; } catch (error) { + debugLogger.log('install', `-- ${error.message}`); return { error }; } }