From 38b397bc7ae10b13924fcd777a262ce7eae6257c Mon Sep 17 00:00:00 2001 From: Faboslav Date: Thu, 19 Sep 2024 11:39:00 +0200 Subject: [PATCH] Renamed callback --- src/util/SchemaValidator.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/util/SchemaValidator.ts b/src/util/SchemaValidator.ts index 4f97014..eea6973 100644 --- a/src/util/SchemaValidator.ts +++ b/src/util/SchemaValidator.ts @@ -10,7 +10,7 @@ export class SchemaValidator { schema: AnySchema, data: unknown, requestContext: RequestContext, - onError?: (err: Error) => T | never, + onValidationError?: (err: Error) => T | never, ): Promise => { try { await schema.validate(data); @@ -21,8 +21,8 @@ export class SchemaValidator { requestContext.enableAlert(new AlertData(AlertType.VALIDATION_ERROR, validationErrorMessage)); - if (onError) { - const result = onError(err); + if (onValidationError) { + const result = onValidationError(err); if (result !== undefined) { return result as T; }