#[derive(Debug, thiserror::Error)]
#[non_exhaustive]
pub enum Error {
#[error("cannot parse the OpenAPI document: {message}")]
Parse {
message: String,
},
#[error("unsupported OpenAPI version {found}: only 3.0.x and 3.1.x are supported")]
UnsupportedVersion {
found: String,
},
#[error("cannot resolve $ref {reference:?} in {at}")]
Ref {
reference: String,
at: String,
},
#[error("duplicate name {name:?}")]
DuplicateName {
name: String,
},
#[error("tool name {name:?} is longer than 64 bytes")]
NameTooLong {
name: String,
},
#[error(
"no absolute base URL: set OpenApiConfig::base_url or give the document an absolute servers[0].url"
)]
NoBaseUrl,
#[error("cannot fetch the OpenAPI document from {url}: {message}")]
Fetch {
url: String,
message: String,
},
#[error("cannot build the HTTP client: {source}")]
HttpClient {
source: Box<dyn std::error::Error + Send + Sync>,
},
#[error("tool {tool}: request failed: {source}")]
Request {
tool: String,
source: Box<dyn std::error::Error + Send + Sync>,
},
#[error("tool {tool}: request timed out")]
Timeout {
tool: String,
},
#[error("tool {tool}: request cancelled")]
Cancelled {
tool: String,
},
}