runtime: better error message in block_on_all on panics (#1166)

This commit is contained in:
Max Bruckner
2019-06-21 11:10:58 -04:00
committed by Toby Lawrence
parent f9a0cb8792
commit 2ac132fb46
+2 -2
View File
@@ -259,7 +259,7 @@ impl Runtime {
let mut entered = enter().expect("nested block_on");
let (tx, rx) = futures::sync::oneshot::channel();
self.spawn(future.then(move |r| tx.send(r).map_err(|_| unreachable!())));
entered.block_on(rx).unwrap()
entered.block_on(rx).expect("blocked on future paniced")
}
/// Run a future to completion on the Tokio runtime, then wait for all
@@ -286,7 +286,7 @@ impl Runtime {
let (tx, rx) = futures::sync::oneshot::channel();
self.spawn(future.then(move |r| tx.send(r).map_err(|_| unreachable!())));
let block = rx
.map_err(|_| unreachable!())
.map_err(|_| panic!("blocked on future paniced"))
.and_then(move |r| {
self.shutdown_on_idle()
.map(move |()| r)