From 2d203dea66348b3f6607ef7b3ad2220c91ebc196 Mon Sep 17 00:00:00 2001 From: Laura Abbott Date: Mon, 23 Sep 2024 19:54:17 -0400 Subject: [PATCH] Properly return an error from `SprocketsClient::connect` (#6641) This inadvertnetly got turned into an `.unwrap()` which wasn't caught in other testing. On the `a4x2` setup, the first connect fails which is expected. Just give the error back. --- sled-agent/src/bootstrap/client.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sled-agent/src/bootstrap/client.rs b/sled-agent/src/bootstrap/client.rs index 02ca18f449..7c1622903c 100644 --- a/sled-agent/src/bootstrap/client.rs +++ b/sled-agent/src/bootstrap/client.rs @@ -24,7 +24,7 @@ use tokio::io::AsyncWriteExt; #[derive(Debug, Error)] pub enum Error { #[error("Could not connect to {addr}: {err}")] - Connect { addr: SocketAddrV6, err: io::Error }, + Connect { addr: SocketAddrV6, err: sprockets_tls::Error }, #[error("Failed serializing request: {0}")] Serialize(serde_json::Error), @@ -115,7 +115,7 @@ impl Client { log.clone(), ) .await - .unwrap(); + .map_err(|err| Error::Connect { addr: self.addr, err })?; let mut stream = Box::new(tokio::io::BufStream::new(stream));