Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@wjones127
Copy link
Contributor

Summary

  • Error::Internal now captures a backtrace instead of using snafu's location!() macro
  • Introduces Error::internal(message) constructor that automatically captures the backtrace at the call site
  • Migrated all 120+ usages across 63 files in 8 crates

🤖 Generated with Claude Code

@github-actions
Copy link
Contributor

Code Review

Summary

This PR migrates Error::Internal from using snafu's location!() macro to capturing full stack traces via std::backtrace::Backtrace::force_capture(). This is a valuable improvement for debugging internal errors.

P0/P1 Issues

P1: Performance concern with force_capture()

In rust/lance-core/src/error.rs:130, the constructor uses Backtrace::force_capture():

pub fn internal(message: impl Into<String>) -> Self {
    let message: String = message.into();
    Self::Internal {
        source: InternalError {
            message,
            backtrace: std::backtrace::Backtrace::force_capture(),
        },
    }
}

force_capture() always captures a backtrace regardless of the RUST_BACKTRACE environment variable setting. This is intentional for debugging internal errors, but has a performance cost. Consider whether Backtrace::capture() (which respects RUST_BACKTRACE) might be more appropriate for production use cases, or document that this is the intended behavior for internal errors since they represent bugs that should be reported.


LGTM overall. The refactoring is mechanical and correct. The test update in page_table.rs correctly adapts to the new error structure by checking .to_string() instead of pattern matching on the message field directly.

…trace

`Error::Internal` now captures a backtrace instead of using snafu's
`location!()` macro. This provides more useful debugging information
when internal errors occur.

Introduces `Error::internal(message)` constructor that automatically
captures the backtrace at the call site.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
@wjones127 wjones127 force-pushed the feat/internal-error-backtrace branch from 22c004b to 4de37f4 Compare December 30, 2025 23:10
@wjones127 wjones127 changed the title refactor: migrate Error::Internal to use constructor method with backtrace feat: add backtraces to internal errors to improve debugging Dec 30, 2025
@github-actions github-actions bot added the enhancement New feature or request label Dec 30, 2025
@wjones127 wjones127 marked this pull request as ready for review December 31, 2025 17:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request python

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant