Skip to content

Improve error reporting from pattern parse failures #288

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

Closed
GoogleCodeExporter opened this issue Mar 15, 2015 · 4 comments
Closed

Improve error reporting from pattern parse failures #288

GoogleCodeExporter opened this issue Mar 15, 2015 · 4 comments
Milestone

Comments

@GoogleCodeExporter
Copy link

(Adapted from 
http://stackoverflow.com/questions/23964736/issue-parsing-nodatime-localdate-fro
m-standard-pattern)

Find the bug in the following:

    var pattern = LocalDatePattern.CreateWithInvariantCulture("D");
    var parseResult = pattern.Parse("Monday, May 26 2014");
    var localDate = parseResult.GetValueOrThrow();
    Console.WriteLine("Parsed value is {0}.", localDate);

The error is:

NodaTime.Text.UnparsableValueException: The value string does not match the 
required number from the format string "dd".

It would be really much more useful if the message explained what the string 
(or at least, string position) was at the point it was trying to find a "dd".

(Tentatively scheduling for 1.3 pending discussion, but if this isn't trivial, 
will punt to later.)

Original issue reported on code.google.com by malcolm.rowe on 31 May 2014 at 9:27

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

No branches or pull requests

2 participants