+ Error handler and refactoring of the http methods

This commit is contained in:
Alexis
2020-05-16 21:30:35 +02:00
parent 875e92393c
commit 7195b4359b
3 changed files with 184 additions and 111 deletions

13
models/Errors.js Normal file
View File

@@ -0,0 +1,13 @@
// Http error w/ code
class HttpError extends Error {
constructor(code, message) {
super(message)
this.name = "HttpError"
this.code = code
Error.captureStackTrace(this, this.constructor);
}
}
module.exports = {
HttpError
}