mirror of
https://github.com/danbulant/jose
synced 2026-05-22 22:09:14 +00:00
19 lines
681 B
JavaScript
19 lines
681 B
JavaScript
const CODES = {
|
|
JWSMissingAlg: 'ERR_JWS_ALG_MISSING',
|
|
JWSInvalidHeader: 'ERR_JWS_INVALID_HEADER',
|
|
JWSNoRecipients: 'ERR_JWS_NO_RECIPIENTS'
|
|
}
|
|
|
|
class JoseError extends Error {
|
|
constructor (message) {
|
|
super(message)
|
|
this.name = this.constructor.name
|
|
this.code = CODES[this.constructor.name]
|
|
Error.captureStackTrace(this, this.constructor)
|
|
}
|
|
}
|
|
|
|
module.exports.JWSMissingAlg = class JWSMissingAlg extends JoseError {}
|
|
module.exports.JWSInvalidHeader = class JWSInvalidHeader extends JoseError {}
|
|
module.exports.JWSNoRecipients = class JWSNoRecipients extends JoseError {}
|
|
module.exports.JWSVerificationFailed = class JWSVerificationFailed extends JoseError {}
|