diff options
author | HimbeerserverDE <himbeerserverde@gmail.com> | 2023-05-05 22:40:17 +0200 |
---|---|---|
committer | HimbeerserverDE <himbeerserverde@gmail.com> | 2023-05-05 22:40:17 +0200 |
commit | ccb9c9954fae2f3a5fc955f3734987bfe6e02aa6 (patch) | |
tree | cfb4ade3cd0b1e9be1091bd108b1547d343ed4f1 | |
parent | f1d6f47f26d2df56e9c84d0ad16aa7151b312812 (diff) |
in case of http errors, print the response text
-rw-r--r-- | src/main.rs | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/main.rs b/src/main.rs index 3b434c0..8e5bb2f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -166,11 +166,19 @@ fn update_instance(args: Args) -> anyhow::Result<()> { } fn upload(clt: &Client, dst: Url, buf: Vec<u8>) -> anyhow::Result<()> { - clt.put(dst) + let resp = clt + .put(dst) .header(CONTENT_TYPE, "application/octet-stream") .body(buf) - .send()? - .error_for_status()?; + .send()?; + + match resp.error_for_status_ref() { + Ok(_) => {} + Err(e) => { + println!("Rustkrazy instance returned an error: {}", resp.text()?); + return Err(e.into()); + } + } Ok(()) } |