chai-backend
chai-backend copied to clipboard
ApiError class: Issue with message property
Don't pass message to super and not comment this.message = message line. This class returning object with message
class ApiError extends Error { constructor( statusCode, message = "Something went wrong", errors = [], stack = "" ) { super(); this.statusCode = statusCode; this.data = null; this.message = message; this.success = false; this.errors = errors;
if (stack) {
this.stack = stack;
} else {
Error.captureStackTrace(this, this.constructor);
}
} }
module.exports = ApiError;