Add URL to statuscode error

This commit is contained in:
asonix 2020-07-25 10:13:00 -05:00
parent 8d493f35a8
commit be07ee0177
2 changed files with 5 additions and 5 deletions

View file

@ -93,8 +93,8 @@ pub enum MyError {
#[error("Couldn't receive request response from {0}, {1}")] #[error("Couldn't receive request response from {0}, {1}")]
ReceiveResponse(String, String), ReceiveResponse(String, String),
#[error("Response has invalid status code, {0}")] #[error("Response from {0} has invalid status code, {1}")]
Status(StatusCode), Status(String, StatusCode),
#[error("Expected an Object, found something else")] #[error("Expected an Object, found something else")]
ObjectFormat, ObjectFormat,

View file

@ -107,7 +107,7 @@ impl Requests {
} }
} }
return Err(MyError::Status(res.status())); return Err(MyError::Status(url.to_string(), res.status()));
} }
let body = res let body = res
@ -163,7 +163,7 @@ impl Requests {
} }
} }
return Err(MyError::Status(res.status())); return Err(MyError::Status(url.to_string(), res.status()));
} }
let bytes = match res.body().limit(1024 * 1024 * 4).await { let bytes = match res.body().limit(1024 * 1024 * 4).await {
@ -216,7 +216,7 @@ impl Requests {
} }
} }
} }
return Err(MyError::Status(res.status())); return Err(MyError::Status(inbox.to_string(), res.status()));
} }
Ok(()) Ok(())