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:
parent
eaf163cb9c
commit
8ae95f6d32
1 changed files with 4 additions and 4 deletions
|
@ -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);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue