feat: 增加日志打印和异常处理

This commit is contained in:
mazxd
2025-05-11 17:55:59 +08:00
parent e43ffe011f
commit fd8b4ec01b
21 changed files with 939 additions and 119 deletions
+14
View File
@@ -0,0 +1,14 @@
export class AppError extends Error {
statusCode: number;
status: string;
isOperational: boolean;
constructor(message: string, statusCode: number) {
super(message);
this.statusCode = statusCode;
this.status = `${statusCode}`.startsWith('4') ? 'fail' : 'error';
this.isOperational = true;
Error.captureStackTrace(this, this.constructor);
}
}