mirror of
https://github.com/neondatabase/neon.git
synced 2025-12-22 21:59:59 +00:00
Display reqwest error source (#10004)
## Problem Reqwest errors don't include details about the inner source error. This means that we get opaque errors like: ``` receive body: error sending request for url (http://localhost:9898/v1/location_config) ``` Instead of the more helpful: ``` receive body: error sending request for url (http://localhost:9898/v1/location_config): operation timed out ``` Touches #9801. ## Summary of changes Include the source error for `reqwest::Error` wherever it's displayed.
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
use std::error::Error as _;
|
||||
|
||||
use chrono::{DateTime, Utc};
|
||||
use futures::Future;
|
||||
use hex::FromHex;
|
||||
@@ -30,14 +32,18 @@ impl std::fmt::Display for Error {
|
||||
match &self.kind {
|
||||
ErrorKind::RequestSend(e) => write!(
|
||||
f,
|
||||
"Failed to send a request. Context: {}, error: {}",
|
||||
self.context, e
|
||||
"Failed to send a request. Context: {}, error: {}{}",
|
||||
self.context,
|
||||
e,
|
||||
e.source().map(|e| format!(": {e}")).unwrap_or_default()
|
||||
),
|
||||
ErrorKind::BodyRead(e) => {
|
||||
write!(
|
||||
f,
|
||||
"Failed to read a request body. Context: {}, error: {}",
|
||||
self.context, e
|
||||
"Failed to read a request body. Context: {}, error: {}{}",
|
||||
self.context,
|
||||
e,
|
||||
e.source().map(|e| format!(": {e}")).unwrap_or_default()
|
||||
)
|
||||
}
|
||||
ErrorKind::ResponseStatus(status) => {
|
||||
|
||||
Reference in New Issue
Block a user