Skip to content

Commit

Permalink
fix: error when no placeholder in error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
hecht-a committed May 2, 2024
1 parent 5ad1690 commit 7f0b84c
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Validator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ class Error {
}

public toString(): string {
if (!this.error.includes("{champ}")) {
return this.error;
}

return `${this.error.replace("{champ}", this.field)}`;
}
}
Expand Down

0 comments on commit 7f0b84c

Please sign in to comment.