Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions crates/core/src/host/instance_env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -857,8 +857,18 @@ impl InstanceEnv {
err
}

fn http_error<E: ToString>(err: E) -> NodesError {
NodesError::HttpError(err.to_string())
fn http_error<E: std::error::Error>(err: E) -> NodesError {
// Include the full error chain, not just the top-level message.
// `reqwest::Error` wraps underlying causes (DNS failure, connection refused,
// timeout, TLS errors, etc.) which are essential for debugging.
use std::fmt::Write;
let mut message = err.to_string();
let mut source = err.source();
while let Some(cause) = source {
write!(message, ": {cause}").unwrap();
source = cause.source();
}
NodesError::HttpError(message)
}

// Then convert the request into an `http::Request`, a semi-standard "lingua franca" type in the Rust ecosystem,
Expand Down Expand Up @@ -888,7 +898,7 @@ impl InstanceEnv {

// Check if we have a blocked IP address, since IP literals bypass DNS resolution.
if is_blocked_ip_literal(reqwest.url()) {
return Err(http_error(BLOCKED_HTTP_ADDRESS_ERROR));
return Err(NodesError::HttpError(BLOCKED_HTTP_ADDRESS_ERROR.to_string()));
}

let redirect_policy = reqwest::redirect::Policy::custom(|attempt| {
Expand Down
Loading