#[derive(Debug, thiserror::Error)]
#[non_exhaustive]
pub enum StreamError {
#[error("stream transport error")]
Transport(#[source] reqwest::Error),
#[error("failed to decode streamed JSON line")]
Decode {
line: String,
#[source]
source: serde_json::Error,
},
#[error("streamed line exceeded the {max}-byte limit without a newline")]
LineTooLong {
max: usize,
},
}
impl StreamError {
pub(crate) fn decode(line: impl Into<String>, source: serde_json::Error) -> Self {
Self::Decode {
line: line.into(),
source,
}
}
}