Skip to content

Commit

Permalink
Only show custom error messages if they are a filled string
Browse files Browse the repository at this point in the history
  • Loading branch information
Bartmr committed Jun 19, 2022
1 parent f342cc1 commit 2354b83
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/schemas/base/base-schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -259,21 +259,21 @@ export abstract class BaseSchema<
protected markAsDefinedInternally(message: undefined | string): void {
this.otherFilters.push({
type: FilterType.UndefinedCatching,
message: message ?? "Input must be defined",
message: message || "Input must be defined",
});
}

protected markAsNotNullInternally(message: undefined | string): void {
this.otherFilters.push({
type: FilterType.NullCatchingFilter,
message: message ?? "Input cannot be null",
message: message || "Input cannot be null",
});
}

protected markAsRequiredInternally(message: undefined | string): void {
this.otherFilters.push({
type: FilterType.NullableCatchingFilter,
message: message ?? "Input is required",
message: message || "Input is required",
});
}

Expand Down

0 comments on commit 2354b83

Please sign in to comment.