-
Notifications
You must be signed in to change notification settings - Fork 96
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
Always add the command
in a validation error's "meta" section.
#204
Comments
In case it helps someone one day, I found an ugly workaround to get the executed command, so I can display its help in case of a validation error:
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I'd like to be able to automatically display the full help of a
command
when a validation fails.Let's say a command has a
--port
option with an associatedvalidator: caporal.NUMBER
validator. I call this command using--port notNumber
: I would like to be able to catch the generated error (in mycatch
block) and manually callawait caporal.exec(['help', COMMAND_NAME]);
in order to display the full help of the command! But the executedcommand
is currently not provided in themeta
section, on such error.Also, it would be appreciated if all errors had a dedicated
code
. For example:code: INVALID_OPTION_VALUE
, so we can know without a doubt what the error is and be able to react to it as we want. Yes, Caporal errors currently have aname
, but this value is the name of the error's constructor (if I'm not mistaken), and this name is actually minified in your distributed code... So not very solid, in my opinion.The text was updated successfully, but these errors were encountered: