diff --git a/object_store/src/client/retry.rs b/object_store/src/client/retry.rs index 5df4ce059c24..28f8a70e0097 100644 --- a/object_store/src/client/retry.rs +++ b/object_store/src/client/retry.rs @@ -30,21 +30,32 @@ use tracing::info; /// Retry request error #[derive(Debug, Snafu)] pub enum Error { + /// The response sent by the cloud provider was a redirect without a + /// location header. This normally indicates an incorrectly configured region. #[snafu(display("Received redirect without LOCATION, this normally indicates an incorrectly configured region"))] BareRedirect, + /// The client received an error response that cannot be retried. #[snafu(display("Client error with status {status}: {}", body.as_deref().unwrap_or("No Body")))] Client { + /// The HTTP status code. status: StatusCode, + /// The error body. body: Option, }, + /// The number of retries was exhausted or the time limit was reached. #[snafu(display("Error after {retries} retries in {elapsed:?}, max_retries:{max_retries}, retry_timeout:{retry_timeout:?}, source:{source}"))] Reqwest { + /// The number of retries attempted. retries: usize, + /// The maximum number of retries allowed. max_retries: usize, + /// The time elapsed since the first attempt. elapsed: Duration, + /// The maximum amount of time to spend retrying. retry_timeout: Duration, + /// The error that occurred while processing a Request. source: reqwest::Error, }, } @@ -68,7 +79,8 @@ impl Error { } } - pub fn error(self, store: &'static str, path: String) -> crate::Error { + #[cfg(any(feature = "aws", feature = "gcp", feature = "azure"))] + pub(crate) fn error(self, store: &'static str, path: String) -> crate::Error { match self.status() { Some(StatusCode::NOT_FOUND) => crate::Error::NotFound { path, diff --git a/object_store/src/lib.rs b/object_store/src/lib.rs index 904cb670e407..fb47d9c87e8b 100644 --- a/object_store/src/lib.rs +++ b/object_store/src/lib.rs @@ -526,8 +526,8 @@ mod client; #[cfg(feature = "cloud")] pub use client::{ - backoff::BackoffConfig, retry::RetryConfig, ClientConfigKey, ClientOptions, CredentialProvider, - StaticCredentialProvider, + backoff::BackoffConfig, retry::Error as ClientError, retry::RetryConfig, ClientConfigKey, + ClientOptions, CredentialProvider, StaticCredentialProvider, }; #[cfg(feature = "cloud")]