use thiserror::Error;
#[derive(Debug, Error)]
#[non_exhaustive]
pub enum Error {
#[error("invalid base url: {0}")]
Url(String),
#[error("http transport error: {0}")]
Http(#[from] reqwest::Error),
#[error("opensearch returned status {status}: {body}")]
Status {
status: u16,
body: String,
},
#[error("msearch slot {slot} failed (status {status}): {body}")]
Msearch {
slot: usize,
status: u16,
body: String,
},
#[error("combined-search hit from unexpected index `{index}`")]
UnexpectedIndex {
index: String,
},
#[error("decoding response: {0}")]
Decode(#[from] serde_json::Error),
}
pub type Result<T> = std::result::Result<T, Error>;