Skip to content
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

Parse failure error should say which argument is failing #69

Open
sebwills opened this issue Oct 25, 2019 · 0 comments
Open

Parse failure error should say which argument is failing #69

sebwills opened this issue Oct 25, 2019 · 0 comments

Comments

@sebwills
Copy link

e.g. if I pass a non-numeric value to an integer argument, I currently get this:

   at System.Number.StringToNumber(ReadOnlySpan`1 str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal)
   at System.Number.ParseInt32(ReadOnlySpan`1 s, NumberStyles style, NumberFormatInfo info)
   at System.Int32.Parse(String s, IFormatProvider provider)
   --- End of inner exception stack trace ---
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at CommandLineParser.Arguments.ValueArgument`1.DefaultConvert(String stringValue)
   at CommandLineParser.Arguments.ValueArgument`1.Convert(String stringValue)
   at CommandLineParser.Arguments.ValueArgument`1.Parse(IList`1 args, Int32& i)
   at CommandLineParser.CommandLineParser.ParseCommandLine(String[] args)

The name of the argument is not mentioned, so it can be hard to know which argument is invalid.

It would be much more friendly if the error said something like "Failed to parse value 'xyz' for argument 'myArg': Input string was not in a correct format".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant