Merge pull request #3784 from zbarbuto/fix/user-status-code
Use statusCode prop for user errors
This commit is contained in:
commit
d23ff84587
|
@ -326,7 +326,7 @@ module.exports = function(User) {
|
|||
var err;
|
||||
if (!tokenId) {
|
||||
err = new Error(g.f('{{accessToken}} is required to logout'));
|
||||
err.status = 401;
|
||||
err.statusCode = 401;
|
||||
process.nextTick(fn, err);
|
||||
return fn.promise;
|
||||
}
|
||||
|
@ -336,7 +336,7 @@ module.exports = function(User) {
|
|||
fn(err);
|
||||
} else if ('count' in info && info.count === 0) {
|
||||
err = new Error(g.f('Could not find {{accessToken}}'));
|
||||
err.status = 401;
|
||||
err.statusCode = 401;
|
||||
fn(err);
|
||||
} else {
|
||||
fn();
|
||||
|
|
|
@ -1280,7 +1280,7 @@ describe('User', function() {
|
|||
it('fails when accessToken is not provided', function(done) {
|
||||
User.logout(undefined, function(err) {
|
||||
expect(err).to.have.property('message');
|
||||
expect(err).to.have.property('status', 401);
|
||||
expect(err).to.have.property('statusCode', 401);
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
@ -1288,7 +1288,7 @@ describe('User', function() {
|
|||
it('fails when accessToken is not found', function(done) {
|
||||
User.logout('expired-access-token', function(err) {
|
||||
expect(err).to.have.property('message');
|
||||
expect(err).to.have.property('status', 401);
|
||||
expect(err).to.have.property('statusCode', 401);
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue