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

Add methods for inspecting JoinErrors #2051

Merged
merged 4 commits into from
Jan 24, 2020

Conversation

dfoxfranke
Copy link
Contributor

Motivation

Currently there's no way for a program to get information about a JoinError except to except to scrape its Display or Debug implementations. And even though the JoinError retains the payload
of a panic, there's no way at all to do anything with it since the Display and Debug implementations don't show it.

Solution

This adds is_cancelled() and is_panic() methods to JoinError, as well as an into_panic() method which, when applicable, returns the payload of the panic.

tokio/src/task/error.rs Outdated Show resolved Hide resolved
tokio/src/task/error.rs Outdated Show resolved Hide resolved
tokio/src/task/error.rs Outdated Show resolved Hide resolved
@carllerche
Copy link
Member

Thoughts @seanmonstar? I know we hit some problems w/ Sync before... do we want to expose the boxed error?

Co-Authored-By: Carl Lerche <me@carllerche.com>
@dfoxfranke
Copy link
Contributor Author

Ping. What are your intentions for this PR?

@carllerche
Copy link
Member

Thanks 👍 I made tweaks, primarily into_* should not return Result. I switched it to panic and added a try_into_* conversion.

Copy link
Contributor

@udoprog udoprog left a comment

Choose a reason for hiding this comment

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

LGTM

@carllerche carllerche merged commit 968c143 into tokio-rs:master Jan 24, 2020
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