@quarks/quarks-iam
Version:
A modern authorization server built to authenticate your users and protect your APIs
39 lines (31 loc) • 728 B
JavaScript
/**
* Module dependencies
*/
var util = require('util')
/**
* ProviderAuthError
*
* This error is used by Passport in the event of an authorization
* error with a third party provider.
*/
function ProviderAuthError (options, status) {
if (!status) {
switch (options.error) {
case 'access_denied': status = 403
break
case 'server_error': status = 502
break
case 'temporarily_unavailable': status = 503
break
}
}
this.name = 'ProviderAuthError'
this.code = options.error || 'server_error'
this.message = options.error_description
this.status = status || 500
}
util.inherits(ProviderAuthError, Error)
/**
* Exports
*/
module.exports = ProviderAuthError