From 4ad44caa5217cf55eed512fc10fd68416a37d31c Mon Sep 17 00:00:00 2001 From: Alyssa Ross Date: Thu, 12 Sep 2024 17:36:54 +0200 Subject: [PATCH] api_client: show response body in ServerResponse Otherwise, you just see output like "Error running command: Server responded with an error: InternalServerError", which isn't very helpful. The response body used to be include with the message, but was removed when the Error enum was converted to thiserror. Fixes: 5d0d56f5 ("api_client: Use thiserror for errors") Signed-off-by: Alyssa Ross --- api_client/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api_client/src/lib.rs b/api_client/src/lib.rs index 973f2ffbc..71ba9e438 100644 --- a/api_client/src/lib.rs +++ b/api_client/src/lib.rs @@ -20,7 +20,7 @@ pub enum Error { MissingProtocol, #[error("Error parsing HTTP Content-Length field: {0}")] ContentLengthParsing(std::num::ParseIntError), - #[error("Server responded with an error: {0:?}")] + #[error("Server responded with an error: {0:?}: {1:?}")] ServerResponse(StatusCode, Option), }