Created the error util

This commit is contained in:
2023-01-14 23:15:07 +01:00
parent 4b9521a75f
commit f237a5f5a0

4
src/utils/error.ts Normal file
View File

@ -0,0 +1,4 @@
import {Response} from "express";
export const sendError = (res: Response, httpCode: number, errorCode: number, message: string, fieldName?: string) =>
res.status(httpCode).json({code: errorCode, message, fieldName});