supercode_runtime/
error.rs1use thiserror::Error;
4
5pub type Result<T> = std::result::Result<T, RuntimeError>;
7
8#[derive(Debug, Error)]
10#[non_exhaustive]
11pub enum RuntimeError {
12 #[error("http transport error: {0}")]
14 Http(#[source] Box<dyn std::error::Error + Send + Sync>),
15
16 #[error("provider returned status {status}: {body}")]
18 Provider {
19 status: u16,
21 body: String,
23 },
24
25 #[error("failed to decode provider response: {0}")]
27 Decode(#[from] serde_json::Error),
28}
29
30impl From<reqwest::Error> for RuntimeError {
31 fn from(error: reqwest::Error) -> Self {
32 Self::Http(Box::new(error))
33 }
34}