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 <hi@alyssa.is>
This commit is contained in:
Alyssa Ross 2024-09-12 17:36:54 +02:00 committed by Rob Bradford
parent 9f53553860
commit 4ad44caa52

View File

@ -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<String>),
}