-
Notifications
You must be signed in to change notification settings - Fork 353
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Passing error information though #167
Comments
You could do that, and it would be acceptable, but is not the correct solution in this case. You can write an new error message formatter `FailureMessage::Unix` and that would be a great PR too.
We also should move the failure formatter functions out of App.hpp.
|
I agree an error formatter is a better solution but its harder to get the information into it. |
CLI11 already has one, see: Lines 1633 to 1650 in da901cc
You can add one of those to the App (simple is the default). |
I think it would require both. The simple formatter just uses the exceptions anyway. So the information needs to be in the exception class for the formatter to use. |
Okay, adding the info to the exception would be a useful PR. |
I'm not sure if or when I will have time to work on this now. |
I’ll work on this at some point unless you get to it first. And #166. Just short on time for a while. |
Hi,
I wanted to adapt the output from CLI11 to match my local standard, which is Unix style.
So instead of:
The following arguments were not expected: foo bar
I want:
MyProgram: error: unexpected arguments "foo", "bar"
and instead of:
The value Foo is not an allowed value for -Bar
I want:
MyProgram: invalid usage, "Foo" is not an allowed value for option "--Bar"
I thought no problem I can simply catch the exceptions and translate them.
This is not possible as the exception classes such as "ConversionError" construct the message but do not preserve the parameters needed:
It would be a simple change to make "member" and "name" member variables of the exception class for this and the other errors.
Would a pull request making this change be accepted (assuming I can find the time)?
Regards,
Bruce.
The text was updated successfully, but these errors were encountered: