From be07ee01779f8dc5f1300c3ff0dffa8c934ad649 Mon Sep 17 00:00:00 2001 From: asonix Date: Sat, 25 Jul 2020 10:13:00 -0500 Subject: [PATCH] Add URL to statuscode error --- src/error.rs | 4 ++-- src/requests.rs | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/error.rs b/src/error.rs index 69b8bb4..38ff0b2 100644 --- a/src/error.rs +++ b/src/error.rs @@ -93,8 +93,8 @@ pub enum MyError { #[error("Couldn't receive request response from {0}, {1}")] ReceiveResponse(String, String), - #[error("Response has invalid status code, {0}")] - Status(StatusCode), + #[error("Response from {0} has invalid status code, {1}")] + Status(String, StatusCode), #[error("Expected an Object, found something else")] ObjectFormat, diff --git a/src/requests.rs b/src/requests.rs index 7d19192..09056fe 100644 --- a/src/requests.rs +++ b/src/requests.rs @@ -107,7 +107,7 @@ impl Requests { } } - return Err(MyError::Status(res.status())); + return Err(MyError::Status(url.to_string(), res.status())); } 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 { @@ -216,7 +216,7 @@ impl Requests { } } } - return Err(MyError::Status(res.status())); + return Err(MyError::Status(inbox.to_string(), res.status())); } Ok(())