Skip to content

Conversation

@acid1103
Copy link
Contributor

@acid1103 acid1103 commented Oct 28, 2018

Provides a nice way to get the ArgSpec of the option which was being overwritten before throwing an OverwrittenOptionException. The ArgSpec is retrieved through OverwrittenOptionException#getOverwritten(), which can be taken advantage of in a custom IExceptionHandler2 to automate exception handling, generate custom error messages, etc.

I was in the process of writing a custom IExceptionHandler2 and noticed some ParameterExceptions have convenience methods for accessing the root of the exception (see MissingParameterException#getMissing()) and thought OverwrittenOptionException was missing such a method. It's a tiny pr, but seems useful to me at least. Thanks for the consideration.

Provides a nice way to get the ArgSpec of the option which was being overwritten before throwing an OverwrittenOptionException. The ArgSpec is retrieved through OverwrittenOptionException#getOverwritten(), which can be taken advantage of in a custom IExceptionHandler2 to automate exception handling, generate custom error messages, etc.
@codecov-io
Copy link

codecov-io commented Oct 28, 2018

Codecov Report

Merging #532 into master will increase coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master     #532      +/-   ##
============================================
+ Coverage     89.14%   89.15%   +<.01%     
  Complexity      285      285              
============================================
  Files             4        4              
  Lines          3933     3936       +3     
  Branches        964      964              
============================================
+ Hits           3506     3509       +3     
  Misses          213      213              
  Partials        214      214
Impacted Files Coverage Δ Complexity Δ
src/main/java/picocli/CommandLine.java 89.18% <100%> (ø) 160 <0> (ø) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c417baf...4608b53. Read the comment docs.

@remkop remkop added this to the 3.8 milestone Oct 28, 2018
@remkop remkop merged commit ab4543d into remkop:master Oct 28, 2018
@remkop
Copy link
Owner

remkop commented Oct 28, 2018

Thanks for the pull request!

@remkop remkop modified the milestones: 4.1, 3.8 Nov 10, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants