ts-express-kit
Version:
A TypeScript starter kit for building Express applications with best practices.
15 lines (13 loc) • 323 B
text/typescript
class AppError extends Error {
public statusCode: number;
constructor(statusCode: number, message: string, stack = '') {
super(message);
this.statusCode = statusCode;
if (stack) {
this.stack = stack;
} else {
Error.captureStackTrace(this, this.constructor);
}
}
}
export default AppError;