From ffa7865427ec1bd58a9c80bbdf4badf3d5416df3 Mon Sep 17 00:00:00 2001 From: Ben Bangert Date: Mon, 4 Dec 2017 13:19:49 -0800 Subject: [PATCH] feat: add error information for debugging connection drops Closes #1002 --- autopush_rs/src/client.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/autopush_rs/src/client.rs b/autopush_rs/src/client.rs index e1fb3089..07902f4f 100644 --- a/autopush_rs/src/client.rs +++ b/autopush_rs/src/client.rs @@ -187,6 +187,7 @@ where } fn transition(&mut self) -> Poll { + let host = self.data.host.clone(); let next_state = match self.state { ClientState::FinishSend(None, None) => { return Err("Bad state, should not have nothing to do".into()) @@ -466,7 +467,12 @@ where ClientState::ShutdownCleanup(ref mut err) => { debug!("State: ShutdownCleanup"); if let Some(err_obj) = err.take() { - debug!("Error for shutdown: {}", err_obj); + let mut error = err_obj.to_string(); + for err in err_obj.iter().skip(1) { + error.push_str("\n"); + error.push_str(&err.to_string()); + } + debug!("Error for shutdown of {}: {}", host, error); }; self.data.shutdown(); ClientState::Done