Created the error util

This commit is contained in:
Mathias Wagner 2023-01-14 23:15:07 +01:00
parent 4b9521a75f
commit f237a5f5a0
Signed by: Mathias
GPG Key ID: B8DC354B0A1F5B44

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});