From 2ac132fb4652901a1a61b5bf7a701056ef7761ea Mon Sep 17 00:00:00 2001 From: Max Bruckner Date: Fri, 21 Jun 2019 17:10:58 +0200 Subject: [PATCH] runtime: better error message in block_on_all on panics (#1166) --- tokio/src/runtime/threadpool/mod.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tokio/src/runtime/threadpool/mod.rs b/tokio/src/runtime/threadpool/mod.rs index 22f0ff3af..ddb4c49fc 100644 --- a/tokio/src/runtime/threadpool/mod.rs +++ b/tokio/src/runtime/threadpool/mod.rs @@ -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)