Skip to content

Pr 1055 traced error err into#3

Open
BatmanAoD wants to merge 2 commits into
rigetti-mainfrom
pr-1055-traced-error-err-into
Open

Pr 1055 traced error err into#3
BatmanAoD wants to merge 2 commits into
rigetti-mainfrom
pr-1055-traced-error-err-into

Conversation

@BatmanAoD
Copy link
Copy Markdown
Collaborator

"local" version of tokio-rs#3555

yaahc and others added 2 commits May 29, 2026 11:19
## Motivation

Right now TracedError is pretty much incompatible with enum heavy error
handling implementations. The way its currently designed you'd have to make
sure that each leaf error independently is wrapped in a `TracedError` so that
all sources end up capturing a SpanTrace.

## Solution

To resolve this I've added a `map` method for transforming the inner type of a
TracedError while preserving the existing SpanTrace. This is still a bit
cumbersome, where before you'd be able to write `result.map_err(|source|
MyError { source, some_context })` now you'll have to write
`result.map_err(|source| source.map(|source| MyError { source, some_context
}))`. To fix this we should probably eventually add an extension trait on
`Result` but I want to experiment with that half of the change in `zebra`
before committing to an API, since it can easily be done out of tree.

Co-authored-by: Eliza Weisman <eliza@buoyant.io>
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.

3 participants