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

Time::Parser should have a more meaningful error message when input string is too short #12047

Closed
straight-shoota opened this issue May 5, 2022 · 0 comments · Fixed by #12124
Labels
kind:bug A bug in the code. Does not apply to documentation, specs, etc. topic:stdlib:time

Comments

@straight-shoota
Copy link
Member

Time.parse! "2021-01", "%F" # Error: Unexpected char: '\0' at 7: "2021-01>>"

This error message is misleading. There is not really a \0 character in the input data. The parser just fails at the terminal character of each Crystal string. This is good because it prevents overflow into random data after the end of the string, but the user-facing error message should just state that the input data is too short / didn't fit the expected format.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind:bug A bug in the code. Does not apply to documentation, specs, etc. topic:stdlib:time
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant