From a8f5f71b3241b1736c35afa0a4c8fd949920d7b9 Mon Sep 17 00:00:00 2001 From: Trevor Buckner Date: Thu, 9 Dec 2021 13:57:43 -0500 Subject: [PATCH] Send 500 error if Google doesn't send an error Fixes crash where error did not contain the expected `response` field from Google. --- server/homebrew.api.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/homebrew.api.js b/server/homebrew.api.js index f846c6d87..e0da74dca 100644 --- a/server/homebrew.api.js +++ b/server/homebrew.api.js @@ -178,7 +178,7 @@ const updateGoogleBrew = async (req, res, next)=>{ const updatedBrew = await GoogleActions.updateGoogleBrew(oAuth2Client, brew); return res.status(200).send(updatedBrew); } catch (err) { - return res.status(err.response.status).send(err); + return res.status(err.response?.status || 500).send(err); } };