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

Unhelpful error on Arg parse #574

Closed
mbStavola opened this issue Jul 7, 2016 · 1 comment
Closed

Unhelpful error on Arg parse #574

mbStavola opened this issue Jul 7, 2016 · 1 comment
Assignees
Labels
C-enhancement Category: Raise on the bar on expectations
Milestone

Comments

@mbStavola
Copy link

For context, this is what was being read in from_yaml():

- es:
  short: e
  help: Sets the ES tag on the output files.
  default_value: 001
  takes_value: true

When running my program I got the very confusing:
thread 'main' panicked at 'called Option::unwrap()on aNone value', ../src/libcore/option.rs:325

Looking at the backtrace, I was able to narrow it down to a Arg::from_yaml() not parsing correctly. But no idea where or why!

The fix was easy: simply wrap 001 in quotes to make it a string. However, it was a bit annoying to figure it out.

It would be nice to see the context of the panic!() in these cases. For example, what arg setting failed.

@kbknapp
Copy link
Member

kbknapp commented Jul 23, 2016

Thanks for filing this! I agree, I think adding an expect instead of unwrap will fix this. Once I get through the existing PRs I'll fix this one as well.

@kbknapp kbknapp added C-enhancement Category: Raise on the bar on expectations P4: nice to have labels Jul 23, 2016
@kbknapp kbknapp self-assigned this Jul 23, 2016
@kbknapp kbknapp added this to the 2.10.5 milestone Aug 26, 2016
kbknapp added a commit that referenced this issue Aug 28, 2016
When errors are made while developing, the panic error messages have
been improved instead of relying on the default panic message which is
extremely unhelpful.

Closes #574
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-enhancement Category: Raise on the bar on expectations
Projects
None yet
Development

No branches or pull requests

2 participants