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

Fallable constructors for less panics (#815) #996

Closed
wants to merge 55 commits into from
Closed
Changes from 1 commit
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
8b3732f
Fallable constructors for less panics (#815)
Zomtir Mar 22, 2023
ee9871d
reconstruct_from_timestamp
Zomtir Mar 22, 2023
e29524f
ParsingNotEnough seems better for partial fields
Zomtir Mar 23, 2023
d1bd74e
Finished regular tests, doctests missing
Zomtir Mar 23, 2023
63c3494
Fixed all tests
Zomtir Mar 23, 2023
d27efa6
Readded lost locales
Zomtir Mar 23, 2023
5b1b711
arbitiary
Zomtir Mar 23, 2023
6eb7743
cargo fmt
Zomtir Mar 23, 2023
5a8eff8
Fixed some warnings
Zomtir Mar 27, 2023
6191156
restore some tests
Zomtir Apr 1, 2023
225b3e4
cosmetic fix
Zomtir Apr 1, 2023
228a689
moving forward
Zomtir Apr 2, 2023
db74841
time to be or not to be
Zomtir Apr 3, 2023
6655ba3
UTC/Local date stuff
Zomtir Apr 6, 2023
890e4c9
Test fixes
Zomtir Apr 6, 2023
34f05c1
Missed some utc/local date offset
Zomtir Apr 6, 2023
92a4308
Fix more tests
Zomtir Apr 6, 2023
0d0d5ba
Test fixing
Zomtir Apr 6, 2023
ec96378
More test fixes
Zomtir Apr 6, 2023
7a39b6e
Rounding Error
Zomtir Apr 6, 2023
7f8f39b
Move test_duration_round_error
Zomtir Apr 6, 2023
af68091
Test fixing...
Zomtir Apr 6, 2023
a3a8e45
Test fixing...2
Zomtir Apr 6, 2023
251f7b9
some ymd
Zomtir Apr 6, 2023
7652f24
final ymd
Zomtir Apr 6, 2023
de821dc
doctest
Zomtir Apr 6, 2023
a817932
doctests
Zomtir Apr 6, 2023
0432bd1
Doctests pass again
Zomtir Apr 6, 2023
5e51295
and_hms_opt for backwards compablity
Zomtir Apr 6, 2023
07df76e
cosmetic changes
Zomtir Apr 6, 2023
3695075
Merge branch 'main' into fallible-constructors
Zomtir Apr 6, 2023
33c0647
Turn result to option
Zomtir Apr 7, 2023
3c319ca
Fix clippy
Zomtir Apr 7, 2023
a52b57d
all features
Zomtir Apr 7, 2023
de66bf2
feature check
Zomtir Apr 7, 2023
d7f0374
serde error handling
Zomtir Apr 7, 2023
246e332
wasm
Zomtir Apr 7, 2023
eda476a
remove vscode config
Zomtir Apr 7, 2023
816df27
ymd gone
Zomtir Apr 7, 2023
4d4197e
serde error
Zomtir Apr 7, 2023
b78a655
From<serde_json::Error>
Zomtir Apr 7, 2023
ca5276c
test returns
Zomtir Apr 7, 2023
b2f508f
windows stuff
Zomtir Apr 7, 2023
573535d
cargo fmt
Zomtir Apr 7, 2023
4fb5696
more windows
Zomtir Apr 7, 2023
7386f59
cargo fmt
Zomtir Apr 7, 2023
d41abc1
more windows
Zomtir Apr 7, 2023
64bbb78
Removed SystemError
Zomtir Apr 9, 2023
79f21ca
cargo fmt...
Zomtir Apr 9, 2023
a46d79a
IO direct
Zomtir Apr 9, 2023
ce5c11a
io error test
Zomtir Apr 9, 2023
c7aa463
cargo fmt
Zomtir Apr 9, 2023
0e341c0
serde_json only as test
Zomtir Apr 9, 2023
9e317ff
serde_json non-dev
Zomtir Apr 9, 2023
74c975f
serde_json dependencies
Zomtir Apr 9, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
serde_json only as test
Zomtir committed Apr 9, 2023
commit 0e341c0c1895f642cd97411977d99c503c63a67c
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -28,7 +28,6 @@ __doctest = []

[dependencies]
serde = { version = "1.0.99", default-features = false, optional = true }
serde_json = { version = "1" }
pure-rust-locales = { version = "0.5.2", optional = true }
criterion = { version = "0.4.0", optional = true }
rkyv = {version = "0.7", optional = true}
@@ -45,6 +44,7 @@ windows-sys = { version = "0.48.0", features = ["Win32_System_Time", "Win32_Foun
iana-time-zone = { version = "0.1.45", optional = true, features = ["fallback"] }

[dev-dependencies]
serde_json = { version = "1" }
serde_derive = { version = "1", default-features = false }
bincode = { version = "1.3.0" }
num-iter = { version = "0.1.35", default-features = false }
8 changes: 8 additions & 0 deletions src/error.rs
Original file line number Diff line number Diff line change
@@ -10,17 +10,24 @@ use std::time::SystemTimeError;
pub enum Error {
/// Invalid date
InvalidDate,

/// Invalid time
InvalidTime,

/// Invalid date time
InvalidDateTime,

/// Invalid time zone
InvalidTimeZone,

/// Ambigious date
AmbiguousDate,

/// Missing date
#[cfg(all(unix, feature = "clock"))]
MissingDate,

/// Time before the the given epoch
#[cfg(all(windows, feature = "clock"))]
SystemTimeBeforeEpoch,

@@ -227,6 +234,7 @@ impl From<core::str::Utf8Error> for Error {
}
}

#[cfg(test)]
#[cfg(feature = "serde")]
#[cfg_attr(docsrs, doc(cfg(feature = "serde")))]
impl From<serde_json::Error> for Error {