Added the field name to the error

This commit is contained in:
Mathias Wagner 2023-01-15 03:33:47 +01:00
parent 884e0be9aa
commit 18d3f8b0ba
Signed by: Mathias
GPG Key ID: B8DC354B0A1F5B44

View File

@ -14,5 +14,5 @@ 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); sendError(res, 400, errorCode, message, error?.details[0].context?.key);
}; };