Skip to content

Commit

Permalink
Merge pull request #549 from toonvanstrijp/fix/exceptionfactory
Browse files Browse the repository at this point in the history
  • Loading branch information
rubiin committed Aug 24, 2023
2 parents 9bfda92 + fc2b70c commit 8f14979
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
4 changes: 1 addition & 3 deletions src/pipes/i18n-validation.pipe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@ export class I18nValidationPipe extends ValidationPipe {
constructor(options?: I18nValidationPipeOptions) {
super({
...options,
exceptionFactory: i18nValidationErrorFactory(
options?.errorHttpStatusCode,
),
exceptionFactory: i18nValidationErrorFactory(),
});
}

Expand Down
4 changes: 1 addition & 3 deletions src/utils/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,10 @@ function validationErrorToI18n(e: ValidationError): I18nValidationError {
}

export function i18nValidationErrorFactory(
status: HttpStatus = HttpStatus.BAD_REQUEST,
): (errors: ValidationError[]) => I18nValidationException {
return (errors: ValidationError[]): I18nValidationException => {
return new I18nValidationException(
errors.map((e) => validationErrorToI18n(e)),
status,
errors.map((e) => validationErrorToI18n(e))
);
};
}
Expand Down

0 comments on commit 8f14979

Please sign in to comment.