refactor: don’t warn for maven ECONNREFUSED

This commit is contained in:
Rhys Arkins 2019-06-01 05:49:38 +02:00
parent cc8e40265b
commit 5763eaa3ed

View file

@ -26,6 +26,10 @@ function isPermissionsIssue(err) {
return err.statusCode === 401 || err.statusCode === 403; return err.statusCode === 401 || err.statusCode === 403;
} }
function isConnectionError(err) {
return err.code === 'ECONNREFUSED';
}
async function downloadHttpProtocol(pkgUrl, hostType = 'maven') { async function downloadHttpProtocol(pkgUrl, hostType = 'maven') {
let raw; let raw;
try { try {
@ -46,6 +50,9 @@ async function downloadHttpProtocol(pkgUrl, hostType = 'maven') {
if (isMavenCentral(pkgUrl)) { if (isMavenCentral(pkgUrl)) {
throw new Error('registry-failure'); throw new Error('registry-failure');
} }
} else if (isConnectionError(err)) {
// istanbul ignore next
logger.info({ pkgUrl }, 'Connection refused to maven registry');
} else { } else {
logger.warn({ err }, `Unknown error requesting ${pkgUrl}`); logger.warn({ err }, `Unknown error requesting ${pkgUrl}`);
} }