use thiserror::Error;
pub type Result<T> = std::result::Result<T, RuntimeError>;
#[derive(Debug, Error)]
#[non_exhaustive]
pub enum RuntimeError {
#[error("http transport error: {0}")]
Http(#[source] Box<dyn std::error::Error + Send + Sync>),
#[error("provider returned status {status}: {body}")]
Provider {
status: u16,
body: String,
},
#[error("failed to decode provider response: {0}")]
Decode(#[from] serde_json::Error),
}
impl From<reqwest::Error> for RuntimeError {
fn from(error: reqwest::Error) -> Self {
Self::Http(Box::new(error))
}
}