From 7bbda4370d45852b23a34353276ec401c5e75c20 Mon Sep 17 00:00:00 2001 From: Yury Semikhatsky Date: Mon, 21 Dec 2020 12:31:01 -0800 Subject: [PATCH] chore: improve error reporting when browse download fails (#4787) --- install-from-github.js | 5 ++++- src/install/installer.ts | 4 +++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/install-from-github.js b/install-from-github.js index 5cf94cece1..ac44f4823c 100644 --- a/install-from-github.js +++ b/install-from-github.js @@ -27,6 +27,9 @@ try { console.log(`Downloading browsers...`); const { installBrowsersWithProgressBar } = require('./lib/install/installer'); -installBrowsersWithProgressBar(__dirname); +installBrowsersWithProgressBar(__dirname).catch(e => { + console.error(`Failed to install browsers, caused by\n${e.stack}`); + process.exit(1); +}); console.log(`Done. Use "npm run watch" to compile.`); diff --git a/src/install/installer.ts b/src/install/installer.ts index c8a2c97c26..6c12eb65e8 100644 --- a/src/install/installer.ts +++ b/src/install/installer.ts @@ -103,7 +103,9 @@ async function validateCache(packagePath: string, browsersPath: string, linksDir // 3. Install missing browsers for this package. const myBrowsersToDownload = await readBrowsersToDownload(packagePath); for (const browser of myBrowsersToDownload) { - await browserFetcher.downloadBrowserWithProgressBar(browsersPath, browser); + await browserFetcher.downloadBrowserWithProgressBar(browsersPath, browser).catch(e => { + throw new Error(`Failed to download ${browser.name}, caused by\n${e.stack}`); + }); await fsWriteFileAsync(browserPaths.markerFilePath(browsersPath, browser), ''); } }