mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-08-22 00:00:11 +02:00
runtime: better error message in block_on_all on panics (#1166)
This commit is contained in:
committed by
Toby Lawrence
parent
f9a0cb8792
commit
2ac132fb46
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user