From 5d63effabc16d17f443407f0df5706f8e77050be Mon Sep 17 00:00:00 2001 From: Paul Melnikow <github@paulmelnikow.com> Date: Thu, 15 Nov 2018 14:25:46 -0500 Subject: [PATCH] Fix a crasher in production (#2313) When I deployed 5e99aad2defac71e31e519f4b0460ce1aa33cfce to s0, shortly after Sentry picked up an unhandled error. I'm not sure which of the legacy badges this is in. The bug was introduced just now, in #2257. Oops! A test would have caught this, but I don't think it's worth wrapping tests around this difficult-to-test code. It makes more sense I think, to refactor the remaining badges that use it, replace it with something using async/await (maybe based on [node-cache](https://www.npmjs.com/package/node-cache), and test that. --- lib/regular-update.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/regular-update.js b/lib/regular-update.js index 528615fb52..ce7916d98d 100644 --- a/lib/regular-update.js +++ b/lib/regular-update.js @@ -54,9 +54,11 @@ function regularUpdate( } if (res.statusCode < 200 || res.statusCode >= 300) { - throw new InvalidResponse({ - prettyMessage: 'intermediate resource inaccessible', - }) + cb( + new InvalidResponse({ + prettyMessage: 'intermediate resource inaccessible', + }) + ) } let reqData -- GitLab