From 6ffeb670ed89a6f6177d371260fc74721f0758d8 Mon Sep 17 00:00:00 2001 From: teor Date: Thu, 28 Jan 2021 07:53:14 +1000 Subject: [PATCH] Log the failed response in an unreachable panic --- zebrad/src/components/inbound.rs | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/zebrad/src/components/inbound.rs b/zebrad/src/components/inbound.rs index 95007422..e200fb21 100644 --- a/zebrad/src/components/inbound.rs +++ b/zebrad/src/components/inbound.rs @@ -191,10 +191,22 @@ impl Service for Inbound { // TryRecvError is not cloneable, so we have to generate a new error from the oneshot, // rather than re-using a clone of the original error let failed_response = failed_setup.try_recv(); - if let Err(error @ TryRecvError::Closed) = failed_response { - return Poll::Ready(Err(error.into())); - } else { - unreachable!("unexpected response from failed Inbound network setup oneshot"); + match failed_response { + Err(error @ TryRecvError::Closed) => { + return Poll::Ready(Err(error.into())); + } + Err(error) => { + unreachable!( + "unexpected error kind from failed Inbound network setup oneshot: {:?}", + error + ); + } + Ok(_) => { + // we can't log the response, because it doesn't impl Debug + unreachable!( + "unexpected success response from failed Inbound network setup oneshot" + ); + } } }