// Strawcore error type — anything that can fail in our Rust core surfaces // as one of these variants. UniFFI maps it to a Kotlin sealed class // `StrawcoreException` so Kotlin can pattern-match on the kind. use thiserror::Error; #[derive(Debug, Error, uniffi::Error)] pub enum StrawcoreError { #[error("network: {msg}")] Network { msg: String }, #[error("extractor: {msg}")] Extractor { msg: String }, #[error("not found: {what}")] NotFound { what: String }, #[error("unsupported: {detail}")] Unsupported { detail: String }, } impl From for StrawcoreError { fn from(e: rustypipe::error::Error) -> Self { // Bucket every rustypipe error into Extractor for now. Phase U-3+ // can pull apart specific cases (e.g. ageRestricted → NotFound, // network timeouts → Network) when we have a tighter UI for it. StrawcoreError::Extractor { msg: e.to_string() } } }