add data to UnauthorizedError so that more information can be returned to client
This commit is contained in:
parent
870a274be9
commit
139843467b
@ -1,8 +1,12 @@
|
|||||||
function UnauthorizedError (code, error) {
|
function UnauthorizedError (code, error) {
|
||||||
Error.call(this, error.message);
|
Error.call(this, error.message);
|
||||||
this.message = error.message;
|
this.message = error.message;
|
||||||
this.code = code;
|
|
||||||
this.inner = error;
|
this.inner = error;
|
||||||
|
this.data = {
|
||||||
|
message: this.message,
|
||||||
|
code: code,
|
||||||
|
type: "UnauthorizedError"
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
UnauthorizedError.prototype = Object.create(Error.prototype);
|
UnauthorizedError.prototype = Object.create(Error.prototype);
|
||||||
|
@ -16,7 +16,8 @@ describe('authorizer', function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
socket.on('error', function(err){
|
socket.on('error', function(err){
|
||||||
err.should.eql("Invalid token: no header in signature 'boooooo'");
|
err.message.should.eql("Invalid token: no header in signature 'boooooo'");
|
||||||
|
err.code.should.eql("invalid_token");
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user