Return errors instead of throwing Exception
nemec opened this issue · comments
It's expected that, at some point, a user will add invalid input. Instead of throwing exceptions we should force the dev to handle them as part of parsing.
Definitely agree. I don't like using exceptions for control flow.
@JVimes if you're using this library, feel free to check out the new 2.0 branch. I just checked in code removing all thrown Exceptions. You now have a pattern-matching-esque return value where parsing success and failure are explicitly handled in code.
If you get a chance to try it out, let me know if you have any feedback. 2.0 is going to contain many breaking changes, so I want to make sure it's designed as well as it can be (and not "best we can do with backwards compatibility" 😀)
@nemec, thanks! Took 2.0 for a spin w/ReadMe sample code. It fixes this issue for me, nicely. Only minor suggestions: update sample code to compile when pasted into blank Console Application (Assert.Fail() not found); and maybe link to the installer for .NET Core Tools in a "developer notes" section, somewhere. Thanks, again!
Shoot, I converted the sample to a unit test so I'd know whenever I broke the sample code, but now I've gone and copied that unit test back into the sample without cleaning it up 😛
Good suggestions, thanks.