aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/main.rs14
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(())
}