Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
8 changes: 4 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"] }
Expand Down
20 changes: 10 additions & 10 deletions crates/akouo-core/src/decode/opus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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(),
}
})
}
Expand Down Expand Up @@ -268,7 +268,7 @@ fn unsupported_layout(channels: u16, mapping_family: Option<u8>) -> DecodeError
};
DecodeError::UnsupportedCodec {
codec: Codec::Other(label),
location: snafu::Location::new(file!(), line!(), column!()),
location: std::panic::Location::caller(),
}
}

Expand All @@ -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;
Expand All @@ -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 =
Expand Down Expand Up @@ -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(),
});
}
};
Expand All @@ -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);
Expand Down Expand Up @@ -416,15 +416,15 @@ 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
// without re-deriving the channel layout - the old rebuild duplicated layout
// 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
Expand Down
8 changes: 4 additions & 4 deletions crates/akouo-core/src/decode/probe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,15 @@ pub async fn open_decoder(path: &Path) -> Result<Box<dyn AudioDecoder>, 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(),
}),

_ => {
let mss = MediaSourceStream::new(
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(),
Expand Down Expand Up @@ -106,7 +106,7 @@ fn probe_format(
) -> Result<Box<dyn symphonia::core::formats::FormatReader + 'static>, 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());
Expand All @@ -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(),
})
}

Expand Down
4 changes: 2 additions & 2 deletions crates/akouo-core/src/decode/wavpack.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
}
}

Expand Down Expand Up @@ -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"),
Expand Down
10 changes: 5 additions & 5 deletions crates/eksetasis/src/cf_bypass/byparr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
});
}
};
Expand Down Expand Up @@ -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(),
});
}
};
Expand All @@ -236,15 +236,15 @@ 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" {
return Err(SearchIndexerError::CfProxyError {
url: redacted.to_string(),
status: byparr_resp.status,
message: byparr_resp.message,
location: snafu::Location::new(file!(), line!(), column!()),
location: std::panic::Location::caller(),
});
}

Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion crates/eksetasis/src/cf_bypass/noop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
})
})
}
Expand Down
8 changes: 4 additions & 4 deletions crates/eksetasis/src/client/cardigann/definition.rs
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ pub fn load_definition_file(path: &Path) -> Result<CardigannDefinition, SearchIn
let text = std::fs::read_to_string(path).map_err(|e| SearchIndexerError::DefinitionLoad {
path: display_path.clone(),
reason: e.to_string(),
location: snafu::Location::new(file!(), line!(), column!()),
location: std::panic::Location::caller(),
})?;
parse_definition(&text, &display_path)
}
Expand All @@ -275,7 +275,7 @@ pub fn parse_definition(
serde_norway::from_str(text).map_err(|e| SearchIndexerError::DefinitionLoad {
path: origin.to_string(),
reason: e.to_string(),
location: snafu::Location::new(file!(), line!(), column!()),
location: std::panic::Location::caller(),
})?;
normalize(&mut definition);
validate(&definition)?;
Expand Down Expand Up @@ -335,12 +335,12 @@ fn validate(def: &CardigannDefinition) -> 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() {
Expand Down
30 changes: 15 additions & 15 deletions crates/eksetasis/src/client/cardigann/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down Expand Up @@ -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
Expand All @@ -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 { .. }) {
Expand Down Expand Up @@ -314,15 +314,15 @@ 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(),
}
}

fn invalid(&self, reason: String) -> SearchIndexerError {
SearchIndexerError::DefinitionInvalid {
definition_id: self.definition.id.clone(),
reason,
location: snafu::Location::new(file!(), line!(), column!()),
location: std::panic::Location::caller(),
}
}

Expand Down Expand Up @@ -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(),
}),
}
}
Expand All @@ -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(),
}
}

Expand Down Expand Up @@ -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));
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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(),
}),
};
}
Expand All @@ -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(),
});
}
};
Expand All @@ -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(),
});
}
}
Expand All @@ -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
Expand Down
Loading