Log the failed response in an unreachable panic

This commit is contained in:
teor 2021-01-28 07:53:14 +10:00
parent eac4fd181a
commit 6ffeb670ed
1 changed files with 16 additions and 4 deletions

View File

@ -191,10 +191,22 @@ impl Service<zn::Request> for Inbound {
// TryRecvError is not cloneable, so we have to generate a new error from the oneshot, // 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 // rather than re-using a clone of the original error
let failed_response = failed_setup.try_recv(); let failed_response = failed_setup.try_recv();
if let Err(error @ TryRecvError::Closed) = failed_response { match failed_response {
return Poll::Ready(Err(error.into())); Err(error @ TryRecvError::Closed) => {
} else { return Poll::Ready(Err(error.into()));
unreachable!("unexpected response from failed Inbound network setup oneshot"); }
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"
);
}
} }
} }