-
Notifications
You must be signed in to change notification settings - Fork 536
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
DelayedFormat: Panic in rendering #1588
Comments
You have a time zone specifier ( We have been working on making this better on the 0.5 branch, including hopefully making this sort of thing fail to compile. |
I see. My assumption was that if a formatting option is not supported, either Yeah, I would love to see a fallible API for this! Thanks! Now that you mentioned the behavior, I understand the intention of the last paragraph of the doc: https://docs.rs/chrono/latest/chrono/naive/struct.NaiveDateTime.html#method.format . I think it might be useful to make these docs more explicit about the "fails" being a thread panic, either by updating the wording of the sentence, or maybe even adding a "Panics" section to the doc similar to the rust-lang docs (example) Anyways, leaving it for you to decide if any it's useful to keep this issue open. Thanks again for the prompt response! |
Would you be able to make a PR with a proposal? Would be much appreciated! |
Okay, submitted #1590 |
It would be amazing if a failable Especially when chrono is used in other libraries (like polars in our case) it is quite annoying to get an unexpected panic in third party code. While this was a configuration error on our part, it was not easy to figure out what went wrong, as Rust does not provide an appropriate panic message either. |
This code:
Results in these debug outputs:
which seem to be all valid.
Then panics when trying to render the formatting to string:
I can repro this on both default features, as well as
{ version = "0.4.38", default-features = false, features = ["std"] }
.The text was updated successfully, but these errors were encountered: