Created the error util

This commit is contained in:
Mathias committed 2023-01-14 23:15:07 +01:00
1 parent 4b9521a75f
commit f237a5f5a0
1 file changed
+4
+4
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});