Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Server: Avoid using map_err in order to preserve #[track_caller] #1078

Merged
merged 1 commit into from
Sep 19, 2023

Conversation

svix-aaron1011
Copy link
Contributor

Motivation

We currently lose #[track_caller] information when our impl<T> Traceable<T> for Result<T> impl is used, due to the use of Result::map_err

Solution

Write a manual match expression, so that we correctly propagate caller information.

`Result::map_err` does not have `#[track_caller]`, so using it will
set the caller information to the parent `fn trace` (rather than
the original caller).
@svix-aaron1011 svix-aaron1011 requested a review from a team September 18, 2023 20:52
@svix-aaron1011 svix-aaron1011 merged commit 1354ac1 into main Sep 19, 2023
3 checks passed
@svix-aaron1011 svix-aaron1011 deleted the aaron1011/fix-track-caller branch September 19, 2023 18:24
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