Skip to content

Improve error reporting from pattern parse failures #288

Description

@GoogleCodeExporter
(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

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions