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

would it be possible to make ParseErrorKind public? #643

Closed
BrianHicks opened this issue Jan 6, 2022 · 2 comments
Closed

would it be possible to make ParseErrorKind public? #643

BrianHicks opened this issue Jan 6, 2022 · 2 comments

Comments

@BrianHicks
Copy link

I'm parsing dates from CLI args. I'd like to accept both %Y-%m-d and %Y-%m-%dT%H:%M:%S formats. I can currently do that with this code:

Utc.datetime_from_str(input, "%Y-%m-%dT%H:%M:%S")
    .or_else(|_| Utc.datetime_from_str(&format!("{}T00:00:00", input), "%Y-%m-%dT%H:%M:%S"))

however, the error messages leave something to be desired. For instance, if I pass in 2022-01-01T25:00:00 I get a "trailing input" error instead of an "out of range" error since I'm only able to see that there was an error, not what kind of error I got. If ParseErrorKind were public, it looks like I could write code that produced better error messages on the command line. Would this be possible (or acceptable as a PR?)

@d-e-s-o
Copy link

d-e-s-o commented Jan 31, 2022

The topic has been brought up in #319 as well. This issue may be a duplicate.

@djc
Copy link
Contributor

djc commented Mar 23, 2022

I'm going to close this in favor of discussion in #319 and the PR in #588.

@djc djc closed this as completed Mar 23, 2022
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

3 participants