UNPKG

652 BJavaScriptView Raw
1/**
2 * Module dependencies
3 */
4
5var util = require('util')
6
7/**
8 * UnauthorizedError
9 */
10
11function UnauthorizedError (options, status) {
12 this.name = 'UnauthorizedError'
13 this.error = options.error
14 this.error_description = options.error_description
15 this.message = options.error_description
16 // this.realm = options.realm
17 // this.scope = options.scope
18 this.statusCode = options.statusCode || 401
19}
20
21util.inherits(UnauthorizedError, Error)
22
23/**
24 * Error Codes
25 */
26
27UnauthorizedError.errorCodes = [
28 'invalid_request',
29 'invalid_token',
30 'insufficient_scope'
31]
32
33/**
34 * Exports
35 */
36
37module.exports = UnauthorizedError