update error handler

This commit is contained in:
Alex Holliday committed 2026-03-25 13:48:50 -07:00
1 parent 1defa52ae8
commit f09f0630dc
1 file changed
+2 -2
+2 -2
View File
@@ -4,14 +4,14 @@ import { AppError } from "@/utils/AppError.js";
const handleErrors = (error: unknown, req: Request, res: Response, _next: NextFunction) => {
const status = error instanceof AppError ? error.status || 500 : 500;
const message = error instanceof AppError ? error.message : "Server error";
const message = error instanceof AppError ? error.message : error instanceof Error ? error.message : "Server error";
const service = error instanceof AppError ? error.service : "unknownService";
const method = error instanceof AppError ? error.method : "unknownMethod";
logger.error({
message: message,
service: service,
method: method,
stack: error instanceof AppError ? error.stack : undefined,
stack: error instanceof Error ? error.stack : undefined,
details: error instanceof AppError ? error.details : undefined,
});
res.status(status).json({