0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-03-11 02:12:21 -05:00

Updated to return Promise.reject rather than throw

no-issue

This is cleaner IMO
This commit is contained in:
Fabien O'Carroll 2019-04-11 16:10:32 +02:00
parent eaf163cb9c
commit 8ae95f6d32

View file

@ -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);