Skip to content

Commit

Permalink
Renamed callback
Browse files Browse the repository at this point in the history
  • Loading branch information
Faboslav committed Sep 19, 2024
1 parent 4e4d22e commit 38b397b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/util/SchemaValidator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export class SchemaValidator {
schema: AnySchema<T>,
data: unknown,
requestContext: RequestContext,
onError?: (err: Error) => T | never,
onValidationError?: (err: Error) => T | never,
): Promise<T> => {
try {
await schema.validate(data);
Expand All @@ -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;
}
Expand Down

0 comments on commit 38b397b

Please sign in to comment.