tustvold commented on code in PR #4915:
URL: https://github.com/apache/arrow-rs/pull/4915#discussion_r1352589030


##########
object_store/src/client/retry.rs:
##########
@@ -198,28 +199,31 @@ impl RetryExt for reqwest::RequestBuilder {
                                 || now.elapsed() > retry_timeout
                                 || !status.is_server_error() {
 
-                                // Get the response message if returned a 
client error
-                                let message = match status.is_client_error() {
+                                return Err(match status.is_client_error() {
                                     true => match r.text().await {
-                                        Ok(message) if !message.is_empty() => 
message,
-                                        Ok(_) => "No Body".to_string(),
-                                        Err(e) => format!("error getting 
response body: {e}")
+                                        Ok(body) => {
+                                            Error::Client {
+                                                body: Some(body).filter(|b| 
!b.is_empty()),
+                                                status,
+                                            }
+                                        }
+                                        Err(e) => {
+                                            Error::Response {
+                                                retries,
+                                                source: e,
+                                            }
+                                        }
                                     }
-                                    false => status.to_string(),
-                                };
-
-                                return Err(Error{
-                                    message,
-                                    retries,
-                                    status: Some(status),
-                                    source: Some(e),
-                                })
-
+                                    false => Error::Response {
+                                        retries,
+                                        source: e,
+                                    }
+                                });
                             }
 
                             let sleep = backoff.next();
                             retries += 1;
-                            info!("Encountered server error, backing off for 
{} seconds, retry {} of {}", sleep.as_secs_f32(), retries, max_retries);
+                            info!("Encountered response error, backing off for 
{} seconds, retry {} of {}", sleep.as_secs_f32(), retries, max_retries);

Review Comment:
   I thought this was less ambiguous, as this branch is for if we received an 
HTTP response with an error status



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to