2
1
mirror of https://github.com/Thream/socketio-jwt.git synced 2024-07-21 09:38:31 +02:00
socketio-jwt/src/UnauthorizedError.ts

17 lines
464 B
TypeScript
Raw Normal View History

2020-12-29 04:05:39 +01:00
export class UnauthorizedError extends Error {
public inner: { message: string }
public data: { message: string, code: string, type: 'UnauthorizedError' }
constructor (code: string, error: { message: string }) {
super(error.message)
this.message = error.message
this.inner = error
this.data = {
message: this.message,
code,
type: 'UnauthorizedError'
}
Object.setPrototypeOf(this, UnauthorizedError.prototype)
}
}