Open Amanp30 opened 4 months ago
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;
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;
} }
module.exports = ApiError;