1use thiserror::Error;
2
3pub type Result<T> = std::result::Result<T, SynthError>;
4
5#[derive(Debug, Error)]
6pub enum SynthError {
7 #[error("missing api key")]
8 MissingApiKey,
9 #[error("http error: {0}")]
10 Http(#[from] reqwest::Error),
11 #[error("json error: {0}")]
12 Json(#[from] serde_json::Error),
13 #[error("io error: {0}")]
14 Io(#[from] std::io::Error),
15 #[error("api error {status}: {body}")]
16 Api { status: u16, body: String },
17 #[error("unexpected response: {0}")]
18 UnexpectedResponse(String),
19 #[error("sse error: {0}")]
20 Sse(String),
21}