forked from Deuxfleurs/garage
Alex
b2a2d3859f
- [x] Better distinguish error types - [x] Parse error messages received from server - [x] Remove `src/` folder layer, we don't have that for other crates Co-authored-by: Alex Auvolat <alex@adnab.me> Reviewed-on: Deuxfleurs/garage#307 Co-authored-by: Alex <alex@adnab.me> Co-committed-by: Alex <alex@adnab.me>
29 lines
742 B
Rust
29 lines
742 B
Rust
use std::borrow::Cow;
|
|
|
|
use thiserror::Error;
|
|
|
|
/// Errors returned by this crate
|
|
#[derive(Error, Debug)]
|
|
pub enum Error {
|
|
#[error("{0}, {1}: {2} (path = {3})")]
|
|
Remote(
|
|
http::StatusCode,
|
|
Cow<'static, str>,
|
|
Cow<'static, str>,
|
|
Cow<'static, str>,
|
|
),
|
|
#[error("received invalid response: {0}")]
|
|
InvalidResponse(Cow<'static, str>),
|
|
#[error("not found")]
|
|
NotFound,
|
|
#[error("io error: {0}")]
|
|
IoError(#[from] std::io::Error),
|
|
#[error("rusoto tls error: {0}")]
|
|
RusotoTls(#[from] rusoto_core::request::TlsError),
|
|
#[error("rusoto http error: {0}")]
|
|
RusotoHttp(#[from] rusoto_core::HttpDispatchError),
|
|
#[error("deserialization error: {0}")]
|
|
Deserialization(#[from] serde_json::Error),
|
|
#[error("{0}")]
|
|
Message(Cow<'static, str>),
|
|
}
|