diff --git a/controllers/user.js b/controllers/user.js index ac34134db..3e6031018 100644 --- a/controllers/user.js +++ b/controllers/user.js @@ -347,9 +347,9 @@ async function getBreachStats(req, res) { }); } const fxaResponse = await FXA.verifyOAuthToken(req.token); - if (!fxaResponse) { - return res.status(404).json({ - errorMessage: "Cannot find FXA for that OAuth token.", + if (fxaResponse.name === "HTTPError") { + return res.status(fxaResponse.statusCode).json({ + errorMessage: "Could not verify FXA OAuth token. FXA returned message: " + fxaResponse.statusMessage, }); } const user = await DB.getSubscriberByFxaUid(fxaResponse.body.user); diff --git a/lib/fxa.js b/lib/fxa.js index 40641dda3..bcffcf66a 100644 --- a/lib/fxa.js +++ b/lib/fxa.js @@ -26,6 +26,7 @@ const FXA = { return response; } catch (e) { log.error("_postTokenRequest", {stack: e.stack}); + return e; } },