diff --git a/crates/catalog/rest/src/catalog.rs b/crates/catalog/rest/src/catalog.rs index a3c24db293..3438cb29e1 100644 --- a/crates/catalog/rest/src/catalog.rs +++ b/crates/catalog/rest/src/catalog.rs @@ -770,7 +770,8 @@ impl Catalog for RestCatalog { return Err(Error::new( ErrorKind::Unexpected, "CommitFailedException, one or more requirements failed. The client may retry.", - )); + ) + .with_retryable(true)); } StatusCode::INTERNAL_SERVER_ERROR => { return Err(Error::new( diff --git a/crates/iceberg/src/error.rs b/crates/iceberg/src/error.rs index 07fd26413d..e69de38575 100644 --- a/crates/iceberg/src/error.rs +++ b/crates/iceberg/src/error.rs @@ -134,6 +134,8 @@ pub struct Error { source: Option, backtrace: Backtrace, + + retryable: bool, } impl Display for Error { @@ -225,9 +227,17 @@ impl Error { // `Backtrace::capture()` will check if backtrace has been enabled // internally. It's zero cost if backtrace is disabled. backtrace: Backtrace::capture(), + + retryable: false, } } + /// Set retryable of the error. + pub fn with_retryable(mut self, retryable: bool) -> Self { + self.retryable = retryable; + self + } + /// Add more context in error. pub fn with_context(mut self, key: &'static str, value: impl Into) -> Self { self.context.push((key, value.into()));