chore: improve error reporting when browse download fails (#4787)
This commit is contained in:
parent
94ee48f8ce
commit
7bbda4370d
|
|
@ -27,6 +27,9 @@ try {
|
||||||
|
|
||||||
console.log(`Downloading browsers...`);
|
console.log(`Downloading browsers...`);
|
||||||
const { installBrowsersWithProgressBar } = require('./lib/install/installer');
|
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.`);
|
console.log(`Done. Use "npm run watch" to compile.`);
|
||||||
|
|
|
||||||
|
|
@ -103,7 +103,9 @@ async function validateCache(packagePath: string, browsersPath: string, linksDir
|
||||||
// 3. Install missing browsers for this package.
|
// 3. Install missing browsers for this package.
|
||||||
const myBrowsersToDownload = await readBrowsersToDownload(packagePath);
|
const myBrowsersToDownload = await readBrowsersToDownload(packagePath);
|
||||||
for (const browser of myBrowsersToDownload) {
|
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), '');
|
await fsWriteFileAsync(browserPaths.markerFilePath(browsersPath, browser), '');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue