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

Make ParseError a real Error enum #161

Merged
merged 4 commits into from
Apr 5, 2024
Merged

Conversation

pitdicker
Copy link
Contributor

To continue #122 by @laralove143.

I added a second error type that is used when deserializing, which can borrow the input string and print a nice message (without needing to allocate).

Fixes @121.

@pitdicker
Copy link
Contributor Author

Interesting. The new CI test with cargo publish doesn't like it if the version of chrono-tz-build is changed. Because it is not yet released, testing the package of chrono-tz fails. Not sure yet what to do.

@pitdicker
Copy link
Contributor Author

Found a workaround: package without verification, extract to a directory with vendored crates, verify against vendored instead of crates.io. Thanks to rust-lang/cargo#1169 (comment).

#[cfg(not(feature = \"std\"))]
pub type ParseError = &'static str;
r#"#[derive(Copy, Clone, Debug, PartialEq, Eq)]
pub struct ParseError;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's do ParseError(()) to avoid it being constructed by external callers?

@@ -42,7 +42,7 @@ filter-by-regex = ["chrono-tz-build/filter-by-regex"]
case-insensitive = ["dep:uncased", "chrono-tz-build/case-insensitive", "phf/uncased"]

[build-dependencies]
chrono-tz-build = { path = "../chrono-tz-build", version = "0.2.1" }
chrono-tz-build = { path = "../chrono-tz-build", version = "0.3.0" }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: just use 0.3 here.

@pitdicker
Copy link
Contributor Author

I'll wait with merging to make #162 part of the new versions.

@pitdicker pitdicker added this pull request to the merge queue Apr 5, 2024
Merged via the queue into chronotope:main with commit 6987cd6 Apr 5, 2024
4 checks passed
@pitdicker pitdicker deleted the error_enum branch April 5, 2024 10:57
@pitdicker
Copy link
Contributor Author

Published 🎉.

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

Successfully merging this pull request may close these issues.

None yet

3 participants