LentiaServices/errors/DefaultError.js
2026-01-25 20:05:53 +01:00

21 lines
528 B
JavaScript

class DefaultError extends Error {
constructor(code, message, cause, name) {
super(message)
this.code = code
this.name = name || "DefaultError"
this.cause = cause || "Internal Server Error"
this.message = message || "Internal Server Error"
this.isOperational = true
Error.captureStackTrace(this, this.constructor)
}
serialize() {
return {
code: this.code,
message: this.message
}
}
}
module.exports = DefaultError