Update README.md#52
Update README.md#52InsanusMokrassar wants to merge 1 commit intoxenomachina:masterfrom InsanusMokrassar:patch-1
Conversation
Add helpfull description for help message showing
Codecov Report
@@ Coverage Diff @@
## master #52 +/- ##
=========================================
Coverage 82.97% 82.97%
Complexity 138 138
=========================================
Files 11 11
Lines 417 417
Branches 82 82
=========================================
Hits 346 346
Misses 36 36
Partials 35 35Continue to review full report at Codecov.
|
| e.printAndExit() | ||
| } | ||
| ``` | ||
|
|
There was a problem hiding this comment.
Thanks for pointing that this was not clear enough!
The supported way to do this is actually to use mainBody, or at least to catch all SystemExitExceptions, as mentioned in the Error Handling section.
Perhaps just change this to say something like:
For help messages to correctly display you must properly handle any
SystemExitExceptionthat is thrown as described in Error Handling.
You could even link to that section.
There was a problem hiding this comment.
Thank you for your response.
I think, that catch only awaited exception (such as ShowHelpException) is best way. In this case we need to catch only exception which will say to show help and catching ShowHelpException will give us all what we need.
There was a problem hiding this comment.
I don't think I understand your point.
ShowHelpException is a subclass of SystemExitException. In most cases you probably want to handle all SystemExitExceptions, not just ShowHelpException. They all contain a message for the user, as well as an exit code. The exit code for ShowHelpException just happens to be 0.
There was a problem hiding this comment.
I mean that any other exception must be handled by other way. In this case we need to catch just ShowHelpException and it is will be ok for show help message
There was a problem hiding this comment.
But you don't need to handle other SystemExitExceptions in a different way. All SystemExitExceptions can be handled by calling their printAndExit() method or by using mainBody (which will call printAndExit for you). It would be pretty unusual to need to catch only ShowHelpException.
Add helpfull description for help message showing