feat: Introduce OxbowError with backtrace capture via thiserror#166
Merged
nvictus merged 1 commit intoabdenlab:mainfrom Mar 6, 2026
Merged
feat: Introduce OxbowError with backtrace capture via thiserror#166nvictus merged 1 commit intoabdenlab:mainfrom
nvictus merged 1 commit intoabdenlab:mainfrom
Conversation
Replace io::Error throughout the oxbow crate with a custom OxbowError enum (thiserror 2.x) that captures backtraces at error creation time. This makes parsing and validation errors from Rust actionable when they surface in Python, where previously only a bare string message was shown. Six variants map to the semantic categories already in use: InvalidInput, InvalidData, NotFound, Io, Arrow, External. Backtraces are captured via std::backtrace::Backtrace (stable since Rust 1.65) inside a CapturedBacktrace newtype that avoids triggering thiserror's unstable Error::provide() codegen. When RUST_BACKTRACE=1 is set, the backtrace is baked into the ArrowError string at the RecordBatchReader boundary so it survives the Arrow C Stream Interface. On the Python side, OxbowError variants map to appropriate exception types (PyValueError, PyKeyError, PyIOError) via a to_py() converter.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR replaces
io::Errorthroughout the oxbow crate with a customOxbowErrorenum usingthiserror2.x. This enum captures backtraces at error creation time, making errors from Rust traceable when they surface in Python. Previously, only a bare string message was shown.Six variants map to the semantic categories already in use: InvalidInput, InvalidData, NotFound, Io, Arrow, External.
When
RUST_BACKTRACE=1is set, the backtrace is baked into theArrowErrorstring at the RecordBatchReader boundary so that it survives the CFFI. On the py-oxbow side,OxbowErrorvariants map to appropriate exception types (PyValueError,PyKeyError,PyIOError) via ato_py()converter.Note
Backtraces are captured via
std::backtrace::Backtrace(stable since Rust 1.65) inside aCapturedBacktracenewtype that avoids triggering code generation bythiserrorusing the currently unstableError::provide(). We will revisit onceprovide()is stabilized in Rust.