fix(rubygems): throw registry-failure when failing to download

This commit is contained in:
Rhys Arkins 2019-05-13 15:42:24 +02:00
parent 7f509b3dbe
commit 9999f47bf6

View file

@ -21,13 +21,13 @@ async function updateRubyGemsVersions() {
logger.debug('Rubygems: Fetching rubygems.org versions'); logger.debug('Rubygems: Fetching rubygems.org versions');
newLines = (await got(url, options)).body; newLines = (await got(url, options)).body;
} catch (err) /* istanbul ignore next */ { } catch (err) /* istanbul ignore next */ {
if (err.statusCode === 416) { if (err.statusCode !== 416) {
logger.debug('Rubygems: No update');
} else {
logger.warn({ err }, 'Rubygems error - resetting cache'); logger.warn({ err }, 'Rubygems error - resetting cache');
contentLength = 0; contentLength = 0;
packageReleases = Object.create(null); // Because we might need a "constructor" key packageReleases = Object.create(null); // Because we might need a "constructor" key
throw new Error('registry-failure');
} }
logger.debug('Rubygems: No update');
lastSync = new Date(); lastSync = new Date();
return; return;
} }