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

RunError is not a proper Error #491

Closed
vorner opened this issue Jul 19, 2018 · 4 comments
Closed

RunError is not a proper Error #491

vorner opened this issue Jul 19, 2018 · 4 comments

Comments

@vorner
Copy link
Contributor

vorner commented Jul 19, 2018

When working with current_thread::Runtime::run, I've noticed the returned RunError does not implement Error (so it is uncomfortable to handle as an error). It also doesn't seem to have any documentation (it is not a link), no idea why, so it is not clear under which circumstances it can happen.

@carllerche
Copy link
Member

👍 would appreciate a PR.

@carllerche carllerche added the E-help-wanted Call for participation: Help is requested to fix this issue. label Jul 19, 2018
@kpp
Copy link
Contributor

kpp commented Jul 20, 2018

@vorner would you please provide a MRE to test against?

@vorner
Copy link
Contributor Author

vorner commented Jul 20, 2018

I'll probably provide even the PR later this weekend, but here goes the MRE (if MRE is Minimum Reproducer or something like that).

extern crate failure;
extern crate tokio;

use failure::Error;
use tokio::prelude::future;
use tokio::runtime::current_thread::Runtime;

fn main() -> Result<(), Error> {
    let mut runtime = Runtime::new()?;
    // Well, this one would actually spawn some things…
    runtime.block_on(future::ok::<_, Error>(()))?;
    // This should wait for the rest of the spawned things… but it doesn't work, because RunError
    // doesn't implement the Error trait
    runtime.run()?;
    Ok(())
}

I went this way in actual real code, because current_thread::run doesn't allow the initialization future to error out and abort on startup.

Both tokio and failure are on their newest versions.

@carllerche
Copy link
Member

The PR has been merged 👍 Thanks again.

@Darksonn Darksonn removed the E-help-wanted Call for participation: Help is requested to fix this issue. label Sep 25, 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

No branches or pull requests

4 participants