diff --git a/Cargo.lock b/Cargo.lock index fe5e38ae..c2b30f0f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5416,18 +5416,18 @@ checksum = "b7c388c1b5e93756d0c740965c41e8822f866621d41acbdf6336a6a168f8840c" [[package]] name = "snafu" -version = "0.8.9" +version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e84b3f4eacbf3a1ce05eac6763b4d629d60cbc94d632e4092c54ade71f1e1a2" +checksum = "e45cb604038abb7b926b679887b3226d8d0f23874b66623625a0454be425a4b7" dependencies = [ "snafu-derive", ] [[package]] name = "snafu-derive" -version = "0.8.9" +version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1c97747dbf44bb1ca44a561ece23508e99cb592e862f22222dcf42f51d1e451" +checksum = "287f59010008f0d7cf5e3b03196d666c1acc46c8d3e9cf34c28a1a7157601e72" dependencies = [ "heck", "proc-macro2", diff --git a/Cargo.toml b/Cargo.toml index 4d6cabc2..64363dde 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -98,7 +98,7 @@ schemars = "1" rmcp = "3.1" # ── Error handling ───────────────────────────────────────────────────────────── -snafu = { version = "0.8", features = ["rust_1_65"] } +snafu = "0.9" # ── Configuration ────────────────────────────────────────────────────────────── figment = { version = "0.10", features = ["toml", "env"] } diff --git a/crates/akouo-core/src/decode/opus.rs b/crates/akouo-core/src/decode/opus.rs index 4c1a955a..b8555401 100644 --- a/crates/akouo-core/src/decode/opus.rs +++ b/crates/akouo-core/src/decode/opus.rs @@ -91,7 +91,7 @@ impl OpusInner { .map(Self::Single) .map_err(|e| DecodeError::OpusDecode { message: format!("failed to initialise libopus decoder: {e:?}"), - location: snafu::Location::new(file!(), line!(), column!()), + location: std::panic::Location::caller(), }) } ChannelLayout::Multi { @@ -144,12 +144,12 @@ fn new_multistream( message: format!( "invalid Opus channel mapping: {streams} streams, {coupled_streams} coupled, {CH} channels" ), - location: snafu::Location::new(file!(), line!(), column!()), + location: std::panic::Location::caller(), })?; opusic_c::multistream::Decoder::new(config, opusic_c::SampleRate::Hz48000).map_err(|e| { DecodeError::OpusDecode { message: format!("failed to initialise libopus multistream decoder: {e:?}"), - location: snafu::Location::new(file!(), line!(), column!()), + location: std::panic::Location::caller(), } }) } @@ -268,7 +268,7 @@ fn unsupported_layout(channels: u16, mapping_family: Option) -> DecodeError }; DecodeError::UnsupportedCodec { codec: Codec::Other(label), - location: snafu::Location::new(file!(), line!(), column!()), + location: std::panic::Location::caller(), } } @@ -292,7 +292,7 @@ impl OpusDecoder { }) .ok_or_else(|| DecodeError::OpusDecode { message: "no Opus track found in OGG container".to_string(), - location: snafu::Location::new(file!(), line!(), column!()), + location: std::panic::Location::caller(), })?; let track_id = track.id; @@ -319,7 +319,7 @@ impl OpusDecoder { .or_else(|| TimeBase::try_from_recip(OPUS_SAMPLE_RATE)) .ok_or_else(|| DecodeError::OpusDecode { message: "failed to derive time base for Opus stream".to_string(), - location: snafu::Location::new(file!(), line!(), column!()), + location: std::panic::Location::caller(), })?; let duration = @@ -365,7 +365,7 @@ impl OpusDecoder { Err(e) => { return Err(DecodeError::SymphoniaRead { message: format!("OGG read error: {e}"), - location: snafu::Location::new(file!(), line!(), column!()), + location: std::panic::Location::caller(), }); } }; @@ -382,7 +382,7 @@ impl OpusDecoder { .decode_float_to_slice(packet.data.as_ref(), &mut self.decode_buf, false) .map_err(|e| DecodeError::OpusDecode { message: format!("decode_float failed: {e:?}"), - location: snafu::Location::new(file!(), line!(), column!()), + location: std::panic::Location::caller(), })?; let channels = usize::from(self.params.channels); @@ -416,7 +416,7 @@ impl OpusDecoder { ) .map_err(|e| DecodeError::SymphoniaRead { message: format!("seek failed: {e}"), - location: snafu::Location::new(file!(), line!(), column!()), + location: std::panic::Location::caller(), })?; // WHY(#544): reset in place (`OPUS_RESET_STATE`) clears post-seek decoder state @@ -424,7 +424,7 @@ impl OpusDecoder { // logic here and silently collapsed >2-channel streams to stereo. self.decoder.reset().map_err(|e| DecodeError::OpusDecode { message: format!("decoder reset after seek failed: {e:?}"), - location: snafu::Location::new(file!(), line!(), column!()), + location: std::panic::Location::caller(), })?; let secs = self diff --git a/crates/akouo-core/src/decode/probe.rs b/crates/akouo-core/src/decode/probe.rs index fa82550e..1b475015 100644 --- a/crates/akouo-core/src/decode/probe.rs +++ b/crates/akouo-core/src/decode/probe.rs @@ -46,7 +46,7 @@ pub async fn open_decoder(path: &Path) -> Result, DecodeEr Some(CODEC_ID_WAVPACK) => Err(DecodeError::UnsupportedCodec { codec: Codec::Other("WavPack".to_string()), - location: snafu::Location::new(file!(), line!(), column!()), + location: std::panic::Location::caller(), }), _ => { @@ -54,7 +54,7 @@ pub async fn open_decoder(path: &Path) -> Result, DecodeEr Box::new(std::fs::File::open(&path).map_err(|e| { DecodeError::SymphoniaRead { message: format!("failed to open {}: {e}", path.display()), - location: snafu::Location::new(file!(), line!(), column!()), + location: std::panic::Location::caller(), } })?), Default::default(), @@ -106,7 +106,7 @@ fn probe_format( ) -> Result, DecodeError> { let file = std::fs::File::open(path).map_err(|e| DecodeError::SymphoniaRead { message: format!("failed to open {}: {e}", path.display()), - location: snafu::Location::new(file!(), line!(), column!()), + location: std::panic::Location::caller(), })?; let mss = MediaSourceStream::new(Box::new(file), Default::default()); @@ -122,7 +122,7 @@ fn probe_format( ) .map_err(|e| DecodeError::SymphoniaRead { message: format!("format probe failed for {}: {e}", path.display()), - location: snafu::Location::new(file!(), line!(), column!()), + location: std::panic::Location::caller(), }) } diff --git a/crates/akouo-core/src/decode/wavpack.rs b/crates/akouo-core/src/decode/wavpack.rs index 9da1cee5..ad712a8a 100644 --- a/crates/akouo-core/src/decode/wavpack.rs +++ b/crates/akouo-core/src/decode/wavpack.rs @@ -23,7 +23,7 @@ pub struct WavPackDecoder; fn unsupported_codec() -> DecodeError { DecodeError::UnsupportedCodec { codec: Codec::Other("WavPack".to_string()), - location: snafu::Location::new(file!(), line!(), column!()), + location: std::panic::Location::caller(), } } @@ -70,7 +70,7 @@ mod tests { // probe.rs returns UnsupportedCodec for WavPack before WavPackDecoder is instantiated. let err = DecodeError::UnsupportedCodec { codec: Codec::Other("WavPack".to_string()), - location: snafu::Location::new(file!(), line!(), column!()), + location: std::panic::Location::caller(), }; assert!( err.to_string().contains("WavPack"), diff --git a/crates/eksetasis/src/cf_bypass/byparr.rs b/crates/eksetasis/src/cf_bypass/byparr.rs index 25f8c5c8..d4b5100b 100644 --- a/crates/eksetasis/src/cf_bypass/byparr.rs +++ b/crates/eksetasis/src/cf_bypass/byparr.rs @@ -174,7 +174,7 @@ impl ByparrProxy { () = ct.cancelled() => { return Err(SearchIndexerError::Cancelled { url: redacted.to_string(), - location: snafu::Location::new(file!(), line!(), column!()), + location: std::panic::Location::caller(), }); } }; @@ -218,7 +218,7 @@ impl ByparrProxy { () = ct.cancelled() => { return Err(SearchIndexerError::Cancelled { url: redacted.to_string(), - location: snafu::Location::new(file!(), line!(), column!()), + location: std::panic::Location::caller(), }); } }; @@ -236,7 +236,7 @@ impl ByparrProxy { serde_json::from_slice(&raw).map_err(|e| SearchIndexerError::ParseResponse { url: redacted.to_string(), error: e.to_string(), - location: snafu::Location::new(file!(), line!(), column!()), + location: std::panic::Location::caller(), })?; if byparr_resp.status != "ok" { @@ -244,7 +244,7 @@ impl ByparrProxy { url: redacted.to_string(), status: byparr_resp.status, message: byparr_resp.message, - location: snafu::Location::new(file!(), line!(), column!()), + location: std::panic::Location::caller(), }); } @@ -254,7 +254,7 @@ impl ByparrProxy { url: redacted.to_string(), status: "ok".to_string(), message: "no solution in response".to_string(), - location: snafu::Location::new(file!(), line!(), column!()), + location: std::panic::Location::caller(), })?; let cookies = solution diff --git a/crates/eksetasis/src/cf_bypass/noop.rs b/crates/eksetasis/src/cf_bypass/noop.rs index ae61c4dc..fa990c2c 100644 --- a/crates/eksetasis/src/cf_bypass/noop.rs +++ b/crates/eksetasis/src/cf_bypass/noop.rs @@ -19,7 +19,7 @@ impl CloudflareProxy for NoProxy { Box::pin(async move { Err(SearchIndexerError::NoCfBypass { url, - location: snafu::Location::new(file!(), line!(), column!()), + location: std::panic::Location::caller(), }) }) } diff --git a/crates/eksetasis/src/client/cardigann/definition.rs b/crates/eksetasis/src/client/cardigann/definition.rs index a996b0c8..bf7324a8 100644 --- a/crates/eksetasis/src/client/cardigann/definition.rs +++ b/crates/eksetasis/src/client/cardigann/definition.rs @@ -260,7 +260,7 @@ pub fn load_definition_file(path: &Path) -> Result Result<(), SearchIndexerError> { let invalid = |reason: String| SearchIndexerError::DefinitionInvalid { definition_id: def.id.clone(), reason, - location: snafu::Location::new(file!(), line!(), column!()), + location: std::panic::Location::caller(), }; let unsupported = |feature: String| SearchIndexerError::DefinitionUnsupported { definition_id: def.id.clone(), feature, - location: snafu::Location::new(file!(), line!(), column!()), + location: std::panic::Location::caller(), }; if def.id.trim().is_empty() { diff --git a/crates/eksetasis/src/client/cardigann/mod.rs b/crates/eksetasis/src/client/cardigann/mod.rs index fc34267e..15652992 100644 --- a/crates/eksetasis/src/client/cardigann/mod.rs +++ b/crates/eksetasis/src/client/cardigann/mod.rs @@ -156,7 +156,7 @@ impl CardigannRegistry { .ok_or_else(|| SearchIndexerError::DefinitionNotFound { indexer_id: indexer.id, url: indexer.url.clone(), - location: snafu::Location::new(file!(), line!(), column!()), + location: std::panic::Location::caller(), })?; CardigannClient::new( Arc::clone(&self.config), @@ -229,7 +229,7 @@ impl CardigannClient { return Err(SearchIndexerError::DefinitionUnsupported { definition_id: definition.id.clone(), feature: "cf_bypass combined with an authenticated login method".to_string(), - location: snafu::Location::new(file!(), line!(), column!()), + location: std::panic::Location::caller(), }); } if indexer.cf_bypass @@ -245,7 +245,7 @@ impl CardigannClient { return Err(SearchIndexerError::DefinitionUnsupported { definition_id: definition.id.clone(), feature: "cf_bypass combined with POST search".to_string(), - location: snafu::Location::new(file!(), line!(), column!()), + location: std::panic::Location::caller(), }); } let login_url = if matches!(login, LoginMethod::Interactive { .. }) { @@ -314,7 +314,7 @@ impl CardigannClient { definition_id: self.definition.id.clone(), indexer_id: self.indexer.id, reason, - location: snafu::Location::new(file!(), line!(), column!()), + location: std::panic::Location::caller(), } } @@ -322,7 +322,7 @@ impl CardigannClient { SearchIndexerError::DefinitionInvalid { definition_id: self.definition.id.clone(), reason, - location: snafu::Location::new(file!(), line!(), column!()), + location: std::panic::Location::caller(), } } @@ -482,7 +482,7 @@ impl CardigannClient { result = fut => result.context(error::HttpRequestSnafu { url: redact_secrets(url) }), () = ct.cancelled() => Err(SearchIndexerError::Cancelled { url: redact_secrets(url), - location: snafu::Location::new(file!(), line!(), column!()), + location: std::panic::Location::caller(), }), } } @@ -496,14 +496,14 @@ impl CardigannClient { SearchIndexerError::RateLimited { indexer_id: self.indexer.id, retry_after_seconds: retry_after, - location: snafu::Location::new(file!(), line!(), column!()), + location: std::panic::Location::caller(), } } fn auth_failed(&self) -> SearchIndexerError { SearchIndexerError::AuthFailed { indexer_id: self.indexer.id, - location: snafu::Location::new(file!(), line!(), column!()), + location: std::panic::Location::caller(), } } @@ -829,7 +829,7 @@ impl IndexerClient for CardigannClient { let rows = extracted.map_err(|e| SearchIndexerError::ParseResponse { url: redact_secrets(url.as_str()), error: e, - location: snafu::Location::new(file!(), line!(), column!()), + location: std::panic::Location::caller(), })?; let rows = self.apply_row_filters(rows, &ctx, query)?; results.extend(self.rows_to_results(rows)); @@ -979,7 +979,7 @@ fn resolve_base_url( let invalid = |reason: String| SearchIndexerError::DefinitionInvalid { definition_id: definition.id.clone(), reason, - location: snafu::Location::new(file!(), line!(), column!()), + location: std::panic::Location::caller(), }; let mut url = match parse_absolute_http(&indexer.url) { Some(from_row) => from_row, @@ -1022,7 +1022,7 @@ fn validate_settings( definition_id: definition.id.clone(), indexer_id: indexer.id, reason, - location: snafu::Location::new(file!(), line!(), column!()), + location: std::panic::Location::caller(), }; for (key, value) in &indexer.settings { @@ -1125,7 +1125,7 @@ fn resolve_login( _ => Err(SearchIndexerError::CookieAuthRequired { definition_id: definition.id.clone(), indexer_id: indexer.id, - location: snafu::Location::new(file!(), line!(), column!()), + location: std::panic::Location::caller(), }), }; } @@ -1136,7 +1136,7 @@ fn resolve_login( return Err(SearchIndexerError::LoginUnsupported { definition_id: definition.id.clone(), method: other.to_string(), - location: snafu::Location::new(file!(), line!(), column!()), + location: std::panic::Location::caller(), }); } }; @@ -1153,7 +1153,7 @@ fn resolve_login( "login requires a non-empty value for setting {key:?}; set it via the \ indexer's settings (e.g. username/password)" ), - location: snafu::Location::new(file!(), line!(), column!()), + location: std::panic::Location::caller(), }); } } @@ -1170,7 +1170,7 @@ fn resolve_login_url( let invalid = |reason: String| SearchIndexerError::DefinitionInvalid { definition_id: definition.id.clone(), reason, - location: snafu::Location::new(file!(), line!(), column!()), + location: std::panic::Location::caller(), }; // INVARIANT: validate() rejects an interactive login without a login.path. let path = definition diff --git a/crates/eksetasis/src/client/cardigann/session.rs b/crates/eksetasis/src/client/cardigann/session.rs index ccd1b121..541c0295 100644 --- a/crates/eksetasis/src/client/cardigann/session.rs +++ b/crates/eksetasis/src/client/cardigann/session.rs @@ -395,7 +395,7 @@ impl CardigannClient { result = fut => result.context(error::HttpRequestSnafu { url: url_label.to_string() }), () = ct.cancelled() => Err(SearchIndexerError::Cancelled { url: url_label.to_string(), - location: snafu::Location::new(file!(), line!(), column!()), + location: std::panic::Location::caller(), }), } } diff --git a/crates/eksetasis/src/client/mod.rs b/crates/eksetasis/src/client/mod.rs index d147b3a5..848d773e 100644 --- a/crates/eksetasis/src/client/mod.rs +++ b/crates/eksetasis/src/client/mod.rs @@ -214,7 +214,7 @@ pub(crate) async fn read_body_bounded( String::from_utf8(body).map_err(|e| SearchIndexerError::ParseResponse { url: redact_secrets(url), error: e.to_string(), - location: snafu::Location::new(file!(), line!(), column!()), + location: std::panic::Location::caller(), }) } @@ -237,7 +237,7 @@ pub(crate) async fn read_body_bytes_bounded( url: redact_secrets(url), size: declared, limit: max_bytes, - location: snafu::Location::new(file!(), line!(), column!()), + location: std::panic::Location::caller(), }); } @@ -253,7 +253,7 @@ pub(crate) async fn read_body_bytes_bounded( url: redact_secrets(url), size: received, limit: max_bytes, - location: snafu::Location::new(file!(), line!(), column!()), + location: std::panic::Location::caller(), }); } body.extend_from_slice(&chunk); @@ -275,7 +275,7 @@ pub(crate) async fn validate_fetch_url(url: &str) -> Result<(), SearchIndexerErr let reject = |reason: &str| SearchIndexerError::UnsafeUrl { url: redact_secrets(url), reason: reason.to_string(), - location: snafu::Location::new(file!(), line!(), column!()), + location: std::panic::Location::caller(), }; let parsed = Url::parse(url).map_err(|_| reject("not a valid URL"))?; diff --git a/crates/eksetasis/src/client/newznab.rs b/crates/eksetasis/src/client/newznab.rs index 965d8284..50467f94 100644 --- a/crates/eksetasis/src/client/newznab.rs +++ b/crates/eksetasis/src/client/newznab.rs @@ -59,7 +59,7 @@ impl NewznabClient { () = ct.cancelled() => { return Err(SearchIndexerError::Cancelled { url: redact_secrets(url), - location: snafu::Location::new(file!(), line!(), column!()), + location: std::panic::Location::caller(), }); } }; @@ -68,7 +68,7 @@ impl NewznabClient { if status == reqwest::StatusCode::UNAUTHORIZED || status == reqwest::StatusCode::FORBIDDEN { return Err(SearchIndexerError::AuthFailed { indexer_id: self.config.id, - location: snafu::Location::new(file!(), line!(), column!()), + location: std::panic::Location::caller(), }); } if status == reqwest::StatusCode::TOO_MANY_REQUESTS { @@ -80,7 +80,7 @@ impl NewznabClient { return Err(SearchIndexerError::RateLimited { indexer_id: self.config.id, retry_after_seconds: retry_after, - location: snafu::Location::new(file!(), line!(), column!()), + location: std::panic::Location::caller(), }); } @@ -100,7 +100,7 @@ impl IndexerClient for NewznabClient { let feed = parse_feed_xml(&xml).map_err(|e| SearchIndexerError::ParseResponse { url: redact_secrets(&url), error: e.to_string(), - location: snafu::Location::new(file!(), line!(), column!()), + location: std::panic::Location::caller(), })?; let results = feed @@ -164,7 +164,7 @@ impl IndexerClient for NewznabClient { parse_caps_xml(&xml).map_err(|e| SearchIndexerError::ParseResponse { url: redact_secrets(&url), error: e.to_string(), - location: snafu::Location::new(file!(), line!(), column!()), + location: std::panic::Location::caller(), }) } diff --git a/crates/eksetasis/src/client/torznab.rs b/crates/eksetasis/src/client/torznab.rs index b4fe84a0..8a80c5da 100644 --- a/crates/eksetasis/src/client/torznab.rs +++ b/crates/eksetasis/src/client/torznab.rs @@ -59,7 +59,7 @@ impl TorznabClient { () = ct.cancelled() => { return Err(SearchIndexerError::Cancelled { url: redact_secrets(url), - location: snafu::Location::new(file!(), line!(), column!()), + location: std::panic::Location::caller(), }); } }; @@ -68,7 +68,7 @@ impl TorznabClient { if status == reqwest::StatusCode::UNAUTHORIZED || status == reqwest::StatusCode::FORBIDDEN { return Err(SearchIndexerError::AuthFailed { indexer_id: self.config.id, - location: snafu::Location::new(file!(), line!(), column!()), + location: std::panic::Location::caller(), }); } if status == reqwest::StatusCode::TOO_MANY_REQUESTS { @@ -80,7 +80,7 @@ impl TorznabClient { return Err(SearchIndexerError::RateLimited { indexer_id: self.config.id, retry_after_seconds: retry_after, - location: snafu::Location::new(file!(), line!(), column!()), + location: std::panic::Location::caller(), }); } @@ -100,7 +100,7 @@ impl IndexerClient for TorznabClient { let feed = parse_feed_xml(&xml).map_err(|e| SearchIndexerError::ParseResponse { url: redact_secrets(&url), error: e.to_string(), - location: snafu::Location::new(file!(), line!(), column!()), + location: std::panic::Location::caller(), })?; let results = feed @@ -173,7 +173,7 @@ impl IndexerClient for TorznabClient { parse_caps_xml(&xml).map_err(|e| SearchIndexerError::ParseResponse { url: redact_secrets(&url), error: e.to_string(), - location: snafu::Location::new(file!(), line!(), column!()), + location: std::panic::Location::caller(), }) } diff --git a/crates/eksetasis/src/search.rs b/crates/eksetasis/src/search.rs index 7743d0be..e5f1f8f9 100644 --- a/crates/eksetasis/src/search.rs +++ b/crates/eksetasis/src/search.rs @@ -180,7 +180,7 @@ impl SearchIndexerService { .await .map_err(|e| SearchIndexerError::Database { source: e, - location: snafu::Location::new(file!(), line!(), column!()), + location: std::panic::Location::caller(), })?; // Step 2: Filter by search function support @@ -352,7 +352,7 @@ impl SearchIndexerService { .await .map_err(|e| SearchIndexerError::Database { source: e, - location: snafu::Location::new(file!(), line!(), column!()), + location: std::panic::Location::caller(), })?; Ok(status) } @@ -380,13 +380,13 @@ impl SearchIndexerService { .map_err(|source| SearchIndexerError::CapsUnavailable { indexer_id, source: Box::new(source), - location: snafu::Location::new(file!(), line!(), column!()), + location: std::panic::Location::caller(), })?; let caps_json = serde_json::to_string(&caps).map_err(|error| SearchIndexerError::ParseResponse { url: indexer.url.clone(), error: error.to_string(), - location: snafu::Location::new(file!(), line!(), column!()), + location: std::panic::Location::caller(), })?; let now = jiff::Timestamp::now().to_string(); @@ -431,7 +431,7 @@ impl SearchIndexerService { .await .map_err(|e| SearchIndexerError::Database { source: e, - location: snafu::Location::new(file!(), line!(), column!()), + location: std::panic::Location::caller(), })?; let now = jiff::Timestamp::now(); let mut refreshed = Vec::new(); @@ -460,11 +460,11 @@ impl SearchIndexerService { .await .map_err(|e| SearchIndexerError::Database { source: e, - location: snafu::Location::new(file!(), line!(), column!()), + location: std::panic::Location::caller(), })? .ok_or_else(|| SearchIndexerError::IndexerNotFound { indexer_id, - location: snafu::Location::new(file!(), line!(), column!()), + location: std::panic::Location::caller(), }) } @@ -638,7 +638,7 @@ fn make_client( serde_json::from_str(json).map_err(|e| SearchIndexerError::SettingsJsonInvalid { indexer_id: indexer.id, reason: e.to_string(), - location: snafu::Location::new(file!(), line!(), column!()), + location: std::panic::Location::caller(), })? } None => BTreeMap::new(), diff --git a/crates/eksetasis/src/search/tests.rs b/crates/eksetasis/src/search/tests.rs index 4a4fa74d..cecfa61e 100644 --- a/crates/eksetasis/src/search/tests.rs +++ b/crates/eksetasis/src/search/tests.rs @@ -264,7 +264,7 @@ async fn seed_indexer(pool: &SqlitePool, url: &str) -> IndexerRow { fn cancelled_error() -> SearchIndexerError { SearchIndexerError::Cancelled { url: "https://example.com/api".to_string(), - location: snafu::Location::new(file!(), line!(), column!()), + location: std::panic::Location::caller(), } } @@ -272,7 +272,7 @@ fn rate_limited_error(retry_after_seconds: Option) -> SearchIndexerError { SearchIndexerError::RateLimited { indexer_id: 1, retry_after_seconds, - location: snafu::Location::new(file!(), line!(), column!()), + location: std::panic::Location::caller(), } } @@ -297,7 +297,7 @@ async fn handle_search_error_auth_failed_marks_failed() { let error = SearchIndexerError::AuthFailed { indexer_id: indexer.id, - location: snafu::Location::new(file!(), line!(), column!()), + location: std::panic::Location::caller(), }; service.handle_search_error(&indexer, &error).await; @@ -313,7 +313,7 @@ async fn handle_search_error_parse_response_marks_degraded() { let error = SearchIndexerError::ParseResponse { url: "https://example.com/api".to_string(), error: "bad xml".to_string(), - location: snafu::Location::new(file!(), line!(), column!()), + location: std::panic::Location::caller(), }; service.handle_search_error(&indexer, &error).await; @@ -334,7 +334,7 @@ async fn handle_search_error_http_request_active_marks_degraded() { .send() .await .unwrap_err(), - location: snafu::Location::new(file!(), line!(), column!()), + location: std::panic::Location::caller(), }; service.handle_search_error(&indexer, &error).await; @@ -358,7 +358,7 @@ async fn handle_search_error_http_request_degraded_escalates_to_failed() { .send() .await .unwrap_err(), - location: snafu::Location::new(file!(), line!(), column!()), + location: std::panic::Location::caller(), }; service.handle_search_error(&indexer, &error).await; diff --git a/crates/kathodos/src/import/conflict.rs b/crates/kathodos/src/import/conflict.rs index 0c461964..fcc88f30 100644 --- a/crates/kathodos/src/import/conflict.rs +++ b/crates/kathodos/src/import/conflict.rs @@ -69,7 +69,7 @@ fn find_suffixed_path(target: &Path, max_suffix: usize) -> Result Result<(), TaxisError> { source_path: parent.clone(), target_path: parent.clone(), source: e, - location: snafu::Location::new(file!(), line!(), column!()), + location: std::panic::Location::caller(), }) }) .await @@ -43,14 +43,14 @@ pub async fn hardlink_or_copy(source: &Path, target: &Path) -> Result Err(TaxisError::FileOperation { operation: "hardlink".into(), source_path: source.clone(), target_path: target.clone(), source: e, - location: snafu::Location::new(file!(), line!(), column!()), + location: std::panic::Location::caller(), }), }) .await @@ -76,7 +76,7 @@ pub async fn copy_file(source: &Path, target: &Path) -> Result Result Err(TaxisError::FileOperation { @@ -118,7 +118,7 @@ pub async fn rename_file(source: &Path, target: &Path) -> Result ImportPipeline { .map_err(|e| TaxisError::MetadataResolutionFailed { path: source.path.clone(), source: e, - location: snafu::Location::new(file!(), line!(), column!()), + location: std::panic::Location::caller(), })?; // Compute target path via naming template diff --git a/crates/kathodos/src/import/template.rs b/crates/kathodos/src/import/template.rs index 90200f60..98ad84e9 100644 --- a/crates/kathodos/src/import/template.rs +++ b/crates/kathodos/src/import/template.rs @@ -172,7 +172,7 @@ fn parse_template( return Err(TaxisError::UnknownToken { token: name, media_type: format!("{media_type:?}"), - location: snafu::Location::new(file!(), line!(), column!()), + location: std::panic::Location::caller(), }); } diff --git a/crates/kathodos/src/scanner/walk.rs b/crates/kathodos/src/scanner/walk.rs index f18d9abc..12c2c9ae 100644 --- a/crates/kathodos/src/scanner/walk.rs +++ b/crates/kathodos/src/scanner/walk.rs @@ -67,7 +67,7 @@ fn walk_library_blocking( TaxisError::ScanWalk { path, source: e, - location: snafu::Location::new(file!(), line!(), column!()), + location: std::panic::Location::caller(), } })?; diff --git a/crates/kathodos/src/sidecar.rs b/crates/kathodos/src/sidecar.rs index 820cadb8..35392210 100644 --- a/crates/kathodos/src/sidecar.rs +++ b/crates/kathodos/src/sidecar.rs @@ -140,10 +140,6 @@ pub struct ShowSidecar { /// /// Returns an error if the file cannot be read or contains invalid TOML. #[must_use = "handle the Result from read_sidecar"] -#[expect( - clippy::result_large_err, - reason = "SidecarError is 136 bytes due to toml::de::Error; boxing would require restructuring the Snafu enum and its public API" -)] pub fn read_sidecar(path: &Path) -> Result { let text = fs::read_to_string(path).context(ReadSnafu { path })?; toml::from_str(&text).context(ParseSnafu { path }) @@ -153,10 +149,6 @@ pub fn read_sidecar(path: &Path) -> Result /// /// Parent directories must already exist. The file is created or overwritten. #[must_use = "handle the Result from write_sidecar"] -#[expect( - clippy::result_large_err, - reason = "SidecarError is 136 bytes due to toml::de::Error; boxing would require restructuring the Snafu enum and its public API" -)] pub fn write_sidecar(path: &Path, data: &T) -> Result<(), SidecarError> { let text = toml::to_string_pretty(data).context(SerializeSnafu { path })?; fs::write(path, text).context(WriteSnafu { path }) diff --git a/crates/theatron/desktop/Cargo.toml b/crates/theatron/desktop/Cargo.toml index a0da6132..d8f535fa 100644 --- a/crates/theatron/desktop/Cargo.toml +++ b/crates/theatron/desktop/Cargo.toml @@ -29,7 +29,7 @@ serde_json = "1" tracing = "0.1" # Error handling -snafu = { version = "0.8", features = ["rust_1_65"] } +snafu = "0.9" # Config persistence dirs = "6"