NightOwl888 commented on issue #268: URL: https://github.com/apache/lucenenet/issues/268#issuecomment-2445014168
Well, that is the problem. Catching the exceptions are *required*. The only way to display them to a user is to first catch them and then show the message. .NET parsers usually have a `TryParse` so you don't have to catch anything - you just put it into your decision logic. If there were some type of error code returned that the user could make sense of, the user could then hook into their own localization code rather than having it baked into the design in some obscure way. But, it doesn't have that. I see your point though, Ron. As long as we keep doing things the wrong way and throwing the exception, there is not much point in doing the localization because the user has the chance to intervene (since they are forced to catch an exception anyway). But the exception is a problem carried over from Java where it is considered acceptable to catch an exception for control flow, which is not the case in .NET. Even if we did a cheesy hack and caught the exceptions for the user just to give them a TryParse method, it would at least fix the API and take the responsibility of catching the exceptions away from them. We could then clean it up later without breaking the API. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@lucenenet.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org