build: improve logging on http errors during release process (#43756)

This commit is contained in:
Samuel Attard 2024-09-17 14:30:51 -07:00 committed by GitHub
parent 233724fe00
commit 10ba87a85e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 41 additions and 6 deletions

View file

@ -15,8 +15,13 @@ module.exports = async function getUrlHash (targetUrl, algorithm = 'sha256', att
search: search.toString()
});
try {
const resp = await got(functionUrl);
if (resp.statusCode !== 200) throw new Error('non-200 status code received from hasher function');
const resp = await got(functionUrl, {
throwHttpErrors: false
});
if (resp.statusCode !== 200) {
console.error('bad hasher function response:', resp.body.trim());
throw new Error('non-200 status code received from hasher function');
}
if (!resp.body) throw new Error('Successful lambda call but failed to get valid hash');
return resp.body.trim();