Skip to content

Commit

Permalink
fix(maven): gracefully handle unsupported protocol error
Browse files Browse the repository at this point in the history
  • Loading branch information
rarkins committed Apr 26, 2020
1 parent 4d13074 commit 2bc36ad
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lib/datasource/maven/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ function isConnectionError(err: { code: string }): boolean {
);
}

function isUnsupportedHostError(err: { name: string }): boolean {
return err.name === 'UnsupportedProtocolError';
}

export async function downloadHttpProtocol(
pkgUrl: url.URL | string,
hostType = id
Expand Down Expand Up @@ -75,6 +79,9 @@ export async function downloadHttpProtocol(
} else if (isConnectionError(err)) {
// istanbul ignore next
logger.debug({ failedUrl }, 'Connection refused to maven registry');
} else if (isUnsupportedHostError(err)) {
// istanbul ignore next
logger.debug({ failedUrl }, 'Unsupported host');
} else {
logger.warn({ failedUrl, err }, 'Unknown error');
}
Expand Down

0 comments on commit 2bc36ad

Please sign in to comment.