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