Skip to content

Commit

Permalink
chore: improve error reporting when browse download fails (#4787)
Browse files Browse the repository at this point in the history
  • Loading branch information
yury-s authored Dec 21, 2020
1 parent 94ee48f commit 7bbda43
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 4 additions & 1 deletion install-from-github.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.`);
4 changes: 3 additions & 1 deletion src/install/installer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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), '');
}
}
Expand Down

0 comments on commit 7bbda43

Please sign in to comment.