1use thiserror::Error as ThisError;
2
3#[derive(Debug, ThisError)]
6pub enum Error {
7 #[error("{body}")]
8 Http { status: u16, body: String },
9 #[error("{0}")]
10 Message(String),
11 #[error(transparent)]
12 Request(#[from] reqwest::Error),
13 #[error(transparent)]
14 Json(#[from] serde_json::Error),
15 #[error(transparent)]
16 WebSocket(#[from] Box<tokio_tungstenite::tungstenite::Error>),
17 #[error("{}", .0.message)]
19 PushRefused(crate::marmot::research::PushRefused),
20}
21
22impl From<tokio_tungstenite::tungstenite::Error> for Error {
23 fn from(error: tokio_tungstenite::tungstenite::Error) -> Self {
24 Error::WebSocket(Box::new(error))
25 }
26}
27
28pub type Result<T> = std::result::Result<T, Error>;