pub type Result<T, E = Error> = std::result::Result<T, E>;
#[derive(thiserror::Error, Debug)]
pub enum Error {
#[error("Reqwest error: {0}")]
ReqwestError(#[from] reqwest::Error),
#[error("Generic error: {source}")]
Generic {
source: Box<dyn std::error::Error + Send + Sync + 'static>,
},
#[error("Object not found: {source}")]
NotFound {
source: Box<dyn std::error::Error + Send + Sync + 'static>,
},
#[error("Object at location already exists: {source}")]
AlreadyExists {
source: Box<dyn std::error::Error + Send + Sync + 'static>,
},
#[error("Request precondition failure: {source}")]
Precondition {
source: Box<dyn std::error::Error + Send + Sync + 'static>,
},
#[error("Object not modified: {source}")]
NotModified {
source: Box<dyn std::error::Error + Send + Sync + 'static>,
},
#[error("The operation lacked the necessary privileges to complete: {source}")]
PermissionDenied {
source: Box<dyn std::error::Error + Send + Sync + 'static>,
},
#[error("The operation lacked valid authentication credentials: {source}")]
Unauthenticated {
source: Box<dyn std::error::Error + Send + Sync + 'static>,
},
#[error("Configuration key: '{}' is not valid.", key)]
UnknownConfigurationKey {
key: String,
},
#[error("Invalid HTTP header value: {0}")]
InvalidHeader(#[from] reqwest::header::InvalidHeaderValue),
#[error("Failed to write recording: {0}")]
RecordingIo(#[from] std::io::Error),
#[error("System clock error: time is before Unix epoch")]
ClockError,
}