use std::time::Duration;
pub type Result<T> = std::result::Result<T, Error>;
#[derive(Debug, thiserror::Error)]
pub enum Error {
#[error("invalid Kodik request: {0}")]
Validation(String),
#[error("invalid request URI: {0}")]
InvalidUri(#[from] hyper::http::uri::InvalidUri),
#[error("could not build HTTP request: {0}")]
RequestBuild(#[from] hyper::http::Error),
#[error("Kodik HTTP transport error: {0}")]
Transport(#[from] hyper::Error),
#[error("Kodik HTTP request did not complete within {} ms", .0.as_millis())]
Timeout(Duration),
#[error("Kodik HTTP response exceeded the configured {limit}-byte body limit")]
ResponseBodyTooLarge {
limit: usize,
},
#[error("could not decode Kodik JSON response: {0}")]
Json(#[from] simd_json::Error),
#[error("Kodik API returned HTTP {status}: {body}")]
HttpStatus {
status: u16,
body: String,
},
}