resolving merge conflicts removed this file for some reason
parent
e8af8f156b
commit
f40c1c34b9
|
@ -0,0 +1,16 @@
|
||||||
|
class HttpError extends Error {
|
||||||
|
constructor (status, message, hint) {
|
||||||
|
super(message)
|
||||||
|
if (typeof status !== 'number') throw new Error('HttpError status must be an integer')
|
||||||
|
this.status = status
|
||||||
|
this.hint = hint || 'none'
|
||||||
|
}
|
||||||
|
send (res) {
|
||||||
|
return res.status(this.status).json({
|
||||||
|
error: this.message,
|
||||||
|
hint: this.hint
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = HttpError
|
Loading…
Reference in New Issue