More readable errors for failed registry requests
This commit is contained in:
parent
d1a6db5747
commit
d05ff65089
|
@ -25,7 +25,8 @@ function fetchNpmPackage(packageConfig) {
|
|||
if (res.statusCode === 200) {
|
||||
resolve(res.pipe(gunzip()).pipe(tar.extract()));
|
||||
} else {
|
||||
reject(res);
|
||||
const spec = `${packageConfig.name}@${packageConfig.version}`;
|
||||
reject(new Error(`Failed to fetch tarball for ${spec}`));
|
||||
}
|
||||
})
|
||||
.on("error", reject);
|
||||
|
|
|
@ -37,7 +37,7 @@ function fetchNpmPackageInfo(packageName) {
|
|||
if (res.statusCode === 200) {
|
||||
resolve(parseJSON(res));
|
||||
} else {
|
||||
reject(res);
|
||||
reject(new Error(`Failed to fetch info for ${packageName}`));
|
||||
}
|
||||
})
|
||||
.on("error", reject);
|
||||
|
|
Loading…
Reference in New Issue