diff --git a/crates/iceberg/Cargo.toml b/crates/iceberg/Cargo.toml index 471b0cbe9..463abdbb0 100644 --- a/crates/iceberg/Cargo.toml +++ b/crates/iceberg/Cargo.toml @@ -41,6 +41,8 @@ storage-s3 = ["opendal/services-s3"] async-std = ["dep:async-std"] tokio = ["tokio/rt-multi-thread"] +nightly = [] + [dependencies] anyhow = { workspace = true } apache-avro = { workspace = true } diff --git a/crates/iceberg/src/error.rs b/crates/iceberg/src/error.rs index 88410826f..f2e42fc0d 100644 --- a/crates/iceberg/src/error.rs +++ b/crates/iceberg/src/error.rs @@ -211,6 +211,13 @@ impl std::error::Error for Error { fn source(&self) -> Option<&(dyn std::error::Error + 'static)> { self.source.as_ref().map(|v| v.as_ref()) } + + #[cfg(feature = "nightly")] + fn provide<'a>(&'a self, request: &mut std::error::Request<'a>) { + if self.backtrace.status() == BacktraceStatus::Captured { + request.provide_ref::(&self.backtrace); + } + } } impl Error { diff --git a/crates/iceberg/src/lib.rs b/crates/iceberg/src/lib.rs index 556ff3e02..ddbb8c8f2 100644 --- a/crates/iceberg/src/lib.rs +++ b/crates/iceberg/src/lib.rs @@ -51,6 +51,7 @@ //! } //! ``` +#![cfg_attr(feature = "nightly", feature(error_generic_member_access))] #![deny(missing_docs)] #[macro_use]