From 5d7d881ab98da52706c5090c9591907fea2fa6ac Mon Sep 17 00:00:00 2001 From: Miguel Palhas Date: Mon, 24 Aug 2026 22:41:17 +0100 Subject: [PATCH] feat(arr): add Error::Decode for bad subtitle bytes --- crates/arr-subs/src/error.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/crates/arr-subs/src/error.rs b/crates/arr-subs/src/error.rs index 6df7d43..747f993 100644 --- a/crates/arr-subs/src/error.rs +++ b/crates/arr-subs/src/error.rs @@ -74,6 +74,19 @@ pub enum Error { #[source] source: std::io::Error, }, + + /// A downloaded subtitle's bytes did not decode under any plausible + /// encoding. + /// + /// Writing mojibake into the library is worse than a failed attempt + /// (#186 already records a failure reason). + #[error("{candidate} did not decode to UTF-8: {detail}")] + Decode { + /// The candidate whose bytes failed to decode. + candidate: CandidateId, + /// What was wrong, short enough to log. + detail: String, + }, } impl Error {