mirror of
https://github.com/jiangrui1994/CloudSaver.git
synced 2026-01-13 08:38:47 +08:00
Initial commit for open-source version
This commit is contained in:
11
backend/src/utils/handleError.ts
Normal file
11
backend/src/utils/handleError.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
import { Response, NextFunction } from "express";
|
||||
import { Logger } from "../utils/logger";
|
||||
export default function handleError(
|
||||
res: Response,
|
||||
error: any,
|
||||
message: string,
|
||||
next: NextFunction
|
||||
) {
|
||||
Logger.error(message, error);
|
||||
next(error || { success: false, message });
|
||||
}
|
||||
Reference in New Issue
Block a user