Skip to content

feat: 'impl Clone' and inner-error access for TracedError#1

Open
BatmanAoD wants to merge 3 commits into
pr-1055-traced-error-err-intofrom
traced-error-improvements
Open

feat: 'impl Clone' and inner-error access for TracedError#1
BatmanAoD wants to merge 3 commits into
pr-1055-traced-error-err-intofrom
traced-error-improvements

Conversation

@BatmanAoD
Copy link
Copy Markdown
Collaborator

@BatmanAoD BatmanAoD commented May 29, 2026

Our "local" version of tokio-rs#3556.

Remainder of motivation and solution copied from kalzoo#1

Motivation

This change makes TracedError a two-way door, making it easier to adopt in a larger codebase.

This change provides an "escape hatch" to be able to read and
extract error stored within a TracedError. Among other things,
this will help adoption of TracedError by:

  • allowing onboarding users to still match against error variants,
    as might be common in test cases

  • allowing crate users to bypass missing or unreleased features

  • allowing for partial migration of a codebase, so that TracedError
    can be used in one portion, and then the original error extracted
    at some interface above which TracedError is not yet used or wanted.

Solution

Add TracedError::get_inner_error to get a ref, and TracedError::to_inner_error to unwrap it entirely

kalzoo and others added 3 commits May 29, 2026 11:20
This change makes TracedError a two-way door, making it
easier to adopt in a larger codebase.

This change provides an "escape hatch" to be able to read and
extract error stored within a TracedError. Among other things,
this will help adoption of TracedError by:

* allowing onboarding users to still match against error variants,
  as might be common in test cases

* allowing crate users to bypass missing or unreleased features

* allowing for partial migration of a codebase, so that TracedError
  can be used in one portion, and then the original error extracted
  at some interface above which TracedError is not yet used or wanted.
@BatmanAoD BatmanAoD marked this pull request as ready for review May 29, 2026 23:49
Copy link
Copy Markdown

@windsurf-bot windsurf-bot Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me 🤙

💡 To request another review, post a new comment with "/windsurf-review".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants