From 8ae95f6d327c27b1a4c8e49d6afe9a5286f7969b Mon Sep 17 00:00:00 2001 From: Fabien O'Carroll Date: Thu, 11 Apr 2019 16:10:32 +0200 Subject: [PATCH] Updated to return Promise.reject rather than throw no-issue This is cleaner IMO --- ghost/members-ssr/index.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ghost/members-ssr/index.js b/ghost/members-ssr/index.js index e78f50b716..b42ae43757 100644 --- a/ghost/members-ssr/index.js +++ b/ghost/members-ssr/index.js @@ -67,9 +67,9 @@ module.exports = function create(options = EMPTY) { const exchangeTokenForSession = wrapFn((req, res, {body, cookies}) => { const token = body; if (!body || typeof body !== 'string') { - throw new BadRequestError({ + return Promise.reject(new BadRequestError({ message: 'Expected body containing JWT' - }); + })); } return verifyJwt(token).then(() => { @@ -92,9 +92,9 @@ module.exports = function create(options = EMPTY) { return membersApi.getMember(claims.sub, token); }); } catch (e) { - throw new BadRequestError({ + return Promise.reject(new BadRequestError({ message: `Cookie ${cookieName} not found` - }); + })); } }, cookieConfig);