diff --git a/Cargo.lock b/Cargo.lock index 044b62cf2ea..702be9001b3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -973,7 +973,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" dependencies = [ "libc", - "windows-sys 0.59.0", + "windows-sys 0.61.2", ] [[package]] @@ -1003,6 +1003,12 @@ dependencies = [ "pin-project-lite", ] +[[package]] +name = "exn" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bad13781b9dd97d4489a74e38bb913254d2877840b0b8dece279193761f1d50f" + [[package]] name = "expectrl" version = "0.7.1" @@ -1324,6 +1330,7 @@ dependencies = [ "anyhow", "async-std", "document-features", + "exn", "gix", "gix-actor", "gix-archive", @@ -1396,6 +1403,7 @@ version = "0.37.1" dependencies = [ "bstr", "document-features", + "exn", "gix-date", "gix-hash", "gix-testtools", @@ -1590,6 +1598,7 @@ version = "0.12.1" dependencies = [ "bstr", "document-features", + "exn", "gix-hash", "gix-testtools", "itoa", @@ -1597,7 +1606,6 @@ dependencies = [ "pretty_assertions", "serde", "smallvec", - "thiserror 2.0.17", ] [[package]] @@ -2218,6 +2226,7 @@ dependencies = [ "bitflags 2.10.0", "bstr", "document-features", + "exn", "gix-commitgraph", "gix-date", "gix-hash", @@ -2851,7 +2860,7 @@ dependencies = [ "libc", "percent-encoding", "pin-project-lite", - "socket2 0.5.10", + "socket2 0.6.1", "tokio", "tower-service", "tracing", @@ -3065,7 +3074,7 @@ checksum = "3640c1c38b8e4e43584d8df18be5fc6b0aa314ce6ebf51b53313d4306cca8e46" dependencies = [ "hermit-abi", "libc", - "windows-sys 0.59.0", + "windows-sys 0.61.2", ] [[package]] @@ -3126,7 +3135,7 @@ dependencies = [ "portable-atomic", "portable-atomic-util", "serde_core", - "windows-sys 0.59.0", + "windows-sys 0.61.2", ] [[package]] @@ -3491,7 +3500,7 @@ version = "0.50.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7957b9740744892f114936ab4a57b3f487491bbeafaf8083688b16841a4240e5" dependencies = [ - "windows-sys 0.59.0", + "windows-sys 0.61.2", ] [[package]] @@ -3830,7 +3839,7 @@ dependencies = [ "quinn-udp", "rustc-hash", "rustls", - "socket2 0.5.10", + "socket2 0.6.1", "thiserror 2.0.17", "tokio", "tracing", @@ -3868,9 +3877,9 @@ dependencies = [ "cfg_aliases", "libc", "once_cell", - "socket2 0.5.10", + "socket2 0.6.1", "tracing", - "windows-sys 0.59.0", + "windows-sys 0.60.2", ] [[package]] @@ -4106,7 +4115,7 @@ dependencies = [ "errno", "libc", "linux-raw-sys", - "windows-sys 0.59.0", + "windows-sys 0.61.2", ] [[package]] @@ -4197,7 +4206,7 @@ dependencies = [ "security-framework 3.5.1", "security-framework-sys", "webpki-root-certs 1.0.4", - "windows-sys 0.59.0", + "windows-sys 0.61.2", ] [[package]] @@ -4687,7 +4696,7 @@ dependencies = [ "getrandom 0.3.4", "once_cell", "rustix", - "windows-sys 0.59.0", + "windows-sys 0.61.2", ] [[package]] @@ -5340,7 +5349,7 @@ version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22" dependencies = [ - "windows-sys 0.59.0", + "windows-sys 0.61.2", ] [[package]] diff --git a/gix-actor/Cargo.toml b/gix-actor/Cargo.toml index 677525558b2..2d3870ee9ba 100644 --- a/gix-actor/Cargo.toml +++ b/gix-actor/Cargo.toml @@ -22,6 +22,7 @@ serde = ["dep:serde", "bstr/serde", "gix-date/serde"] gix-date = { version = "^0.12.1", path = "../gix-date" } gix-utils = { version = "^0.3.1", path = "../gix-utils" } +exn = "0.2.1" thiserror = "2.0.17" bstr = { version = "1.12.0", default-features = false, features = [ "std", diff --git a/gix-actor/src/signature/mod.rs b/gix-actor/src/signature/mod.rs index 6641b10de57..40adb4e4629 100644 --- a/gix-actor/src/signature/mod.rs +++ b/gix-actor/src/signature/mod.rs @@ -15,7 +15,7 @@ mod _ref { } /// Try to parse the timestamp and create an owned instance from this shared one. - pub fn to_owned(&self) -> Result { + pub fn to_owned(&self) -> Result { Ok(Signature { name: self.name.to_owned(), email: self.email.to_owned(), @@ -58,7 +58,7 @@ mod _ref { /// Parse the `time` field for access to the passed time since unix epoch, and the time offset. /// The format is expected to be [raw](gix_date::parse_header()). - pub fn time(&self) -> Result { + pub fn time(&self) -> Result { self.time.parse() } } diff --git a/gix-date/Cargo.toml b/gix-date/Cargo.toml index 45c1ef1b9f0..e703c86b145 100644 --- a/gix-date/Cargo.toml +++ b/gix-date/Cargo.toml @@ -23,7 +23,7 @@ bstr = { version = "1.12.0", default-features = false, features = ["std"] } serde = { version = "1.0.114", optional = true, default-features = false, features = ["derive"] } itoa = "1.0.17" jiff = "0.2.17" -thiserror = "2.0.17" +exn = "0.2.1" # TODO: used for quick and easy `TimeBacking: std::io::Write` implementation, but could make that `Copy` # and remove this dep with custom impl smallvec = { version = "1.15.1", features = ["write"] } diff --git a/gix-date/src/parse/function.rs b/gix-date/src/parse/function.rs index 00b000be4d2..6fa5b946a07 100644 --- a/gix-date/src/parse/function.rs +++ b/gix-date/src/parse/function.rs @@ -71,7 +71,7 @@ use crate::{ /// If `now` is October 27, 2023 at 10:00:00 UTC: /// * `2 minutes ago` (October 27, 2023 at 09:58:00 UTC) /// * `3 hours ago` (October 27, 2023 at 07:00:00 UTC) -pub fn parse(input: &str, now: Option) -> Result { +pub fn parse(input: &str, now: Option) -> exn::Result { Ok(if let Ok(val) = Date::strptime(SHORT.0, input) { let val = val .to_zoned(TimeZone::UTC) @@ -97,7 +97,7 @@ pub fn parse(input: &str, now: Option) -> Result { // Format::Raw val } else { - return Err(Error::InvalidDateString { input: input.into() }); + exn::bail!(Error::InvalidDateString { input: input.into() }) }) } @@ -168,7 +168,7 @@ pub fn parse_header(input: &str) -> Option