refactor(maven): log host error separately

This commit is contained in:
Rhys Arkins 2019-03-12 07:44:46 +01:00
parent c3af5b1875
commit 46f2c58249

View file

@ -137,6 +137,9 @@ async function downloadHttpProtocol(pkgUrl) {
} catch (err) {
if (isNotFoundError(err)) {
logger.debug(`Url not found ${pkgUrl}`);
} else if (isHostError(err)) {
// istanbul ignore next
logger.warn({ pkgUrl }, 'Cannot connect to maven host');
} else if (isPermissionsIssue(err)) {
logger.warn(
{ pkgUrl },
@ -165,6 +168,10 @@ function isTemporalError(err) {
);
}
function isHostError(err) {
return err.code === 'ETIMEDOUT';
}
function isNotFoundError(err) {
return err.code === 'ENOTFOUND' || err.statusCode === 404;
}