easy-express-cwa
Version:
CLI tool to setup a common Express.js backend developed by codewithashim
16 lines (13 loc) • 334 B
text/typescript
class ApiError extends Error {
statusCode: number;
constructor(statusCode: number, message: string | undefined, stack = '') {
super(message);
this.statusCode = statusCode;
if (stack) {
this.stack = stack;
} else {
Error.captureStackTrace(this, this.constructor);
}
}
}
export default ApiError;