-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Change error messages #37
Comments
Yes, because this method is intended to customize the error message of a specific input reader. There is currently no API method to set a global custom ErrorMessageProvider. Here is an example of changing the error messages of an age input reader:
What is your use case? |
I just want to have custom error message and custom validation, and that code is exactly what I needed. But days after tweaking it I get into more better solution, this code set the String name;
textIO.getTextTerminal().setBookmark("name");
while (true) {
name= textIO.newStringInputReader().withMinLength(0).read("Enter your name: ");
if (name.length() < 3) {
textIO.getTextTerminal().println("Name is not valid!");
textIO.newStringInputReader().withMinLength(0).read("Press enter to continue.");
textIO.getTextTerminal().resetToBookmark("name");
continue;
}
break;
} Thanks for the response :) |
Hi,
I'm still clueless to change error message when using text-io, do I need to call withParseErrorMessagesProvider for every input reader that have been made?
Thanks.
The text was updated successfully, but these errors were encountered: