From e1e351d95633ea997c4caf20b65124f30a6e17b2 Mon Sep 17 00:00:00 2001 From: tophf Date: Sat, 6 Aug 2022 23:35:01 +0300 Subject: [PATCH] report network failures in build-vendor --- tools/build-vendor.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/build-vendor.js b/tools/build-vendor.js index 8f2ec5e7..b4d2d87c 100644 --- a/tools/build-vendor.js +++ b/tools/build-vendor.js @@ -93,7 +93,9 @@ async function buildFiles(pkg, flatPkg, patterns) { pattern = pattern.replace('{VERSION}', require(`${pkg}/package.json`).version); const [src, dest = !keepDirs && getFileName(src)] = pattern.split(/\s*->\s*/); if (/^https?:/.test(src)) { - fse.outputFileSync(`vendor/${flatPkg}/${dest}`, await (await fetch(src)).text()); + const req = await fetch(src); + if (req.status >= 400) throw new Error(`Network error ${req.status} for ${src}`); + fse.outputFileSync(`vendor/${flatPkg}/${dest}`, await req.text()); fetched += `* ${dest}: ${src}\n`; } else { const files = glob(`node_modules/${pkg}/${src}`);