From 7dd1bcac58db8f357a272756f5017792f58950e4 Mon Sep 17 00:00:00 2001 From: Dietmar Maurer Date: Mon, 27 May 2019 09:35:30 +0200 Subject: [PATCH] src/client/http_client.rs: correctly parse error response in download_chunk_list --- src/client/http_client.rs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/client/http_client.rs b/src/client/http_client.rs index a68461a1..0cb00731 100644 --- a/src/client/http_client.rs +++ b/src/client/http_client.rs @@ -587,13 +587,12 @@ impl BackupClient { .map_err(Error::from) .and_then(move |resp| { let status = resp.status(); + if !status.is_success() { - bail!("download chunk list failed with status {}", status); + future::Either::A(H2Client::h2api_response(resp).and_then(|_| { bail!("unknown error"); })) + } else { + future::Either::B(future::ok(resp.into_body())) } - - let (_head, body) = resp.into_parts(); - - Ok(body) }) .and_then(move |mut body| {