Chapter 12. Handling Errors

Users can botch program input in more ways than you could ever imagine. To detect an error, check JSAPResult.success() after parsing the command line. It will return false if there were any problems.

Once you detect a problem, you have a number of options:

If you have used SimpleJSAP error handling is largely simplified, as it will be handled automatically. Remember just to call messagePrinted() after parsing and take appropriate action.