Fixed the error util

This commit is contained in:
Mathias Wagner 2023-01-15 18:35:49 +01:00
parent 418a81dadb
commit 3ce7b1941d
Signed by: Mathias
GPG Key ID: B8DC354B0A1F5B44

View File

@ -14,5 +14,7 @@ export const validateSchema = (res: Response, schema: ObjectSchema, object: Reco
const errorCode: number = codeMappings[error?.details[0].type || "any"] || 0; const errorCode: number = codeMappings[error?.details[0].type || "any"] || 0;
const message: string = error?.details[0].message || "No message provided"; const message: string = error?.details[0].message || "No message provided";
sendError(res, 400, errorCode, message, error?.details[0].context?.key); if (error) sendError(res, 400, errorCode, message, error?.details[0].context?.key);
return error;
}; };