use reqwest;
use std::collections::HashMap;
#[derive(Debug, thiserror::Error)]
pub enum Error {
#[error{"request timeout: {0}"}]
RequestTimeout(String),
#[error{"invalid argument: {0}"}]
InvalidArgument(String),
#[error{"request internal error: {0}"}]
Internal(String),
#[allow(clippy::enum_variant_names)]
#[error(transparent)]
BackendError(#[from] BackendError),
#[allow(clippy::enum_variant_names)]
#[error(transparent)]
ProxyError(#[from] ProxyError),
#[allow(clippy::enum_variant_names)]
#[error(transparent)]
DfdaemonError(#[from] DfdaemonError),
}
#[derive(Debug, thiserror::Error)]
#[error(
"backend server error, message: {message:?}, header: {header:?}, status_code: {status_code:?}"
)]
pub struct BackendError {
pub message: Option<String>,
pub header: HashMap<String, String>,
pub status_code: Option<reqwest::StatusCode>,
}
#[derive(Debug, thiserror::Error)]
#[error(
"proxy server error, message: {message:?}, header: {header:?}, status_code: {status_code:?}"
)]
pub struct ProxyError {
pub message: Option<String>,
pub header: HashMap<String, String>,
pub status_code: Option<reqwest::StatusCode>,
}
#[derive(Debug, thiserror::Error)]
#[error("dfdaemon error, message: {message:?}")]
pub struct DfdaemonError {
pub message: Option<String>,
}