mirror of
https://github.com/BobbyWibowo/lolisafe.git
synced 2024-12-13 07:56:23 +00:00
b35f4ae6eb
this required expanding our custom error classes with support for arbitrary internal api error codes however it'll only be used for invalid token errors for now (10001) no plan to assign codes to other existing api errors at that point it's probably better to redo the whole api infrastructure
19 lines
288 B
JavaScript
19 lines
288 B
JavaScript
class ClientError extends Error {
|
|
constructor (message, options = {}) {
|
|
super(message)
|
|
|
|
const {
|
|
statusCode,
|
|
code
|
|
} = options
|
|
|
|
this.statusCode = statusCode !== undefined
|
|
? statusCode
|
|
: 400
|
|
|
|
this.code = code
|
|
}
|
|
}
|
|
|
|
module.exports = ClientError
|