chai-backend icon indicating copy to clipboard operation
chai-backend copied to clipboard

ApiError class: Issue with message property

Open Amanp30 opened this issue 6 months ago • 0 comments

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;

Amanp30 avatar Jul 29 '24 06:07 Amanp30