Skip to content

Commit f66f337

Browse files
authored
Fix login_spec_16_invalid_url (#851)
reqwest was recently updated. It's likely that its internal implementation changes lead to it now reports a different error when connecting to an non-existing domain. The casting to `ResolveError` (`as_dns_error`) no longer works. This commit add a final check to see whether the error is a connecting error, and report the error as 'NonExistingSiteError' accordingly.
1 parent 53b59e4 commit f66f337

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

wp_api/src/reqwest_request_executor.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,17 @@ impl From<reqwest::Error> for RequestExecutionError {
228228
};
229229
}
230230

231+
if error.is_connect() {
232+
return RequestExecutionError::RequestExecutionFailed {
233+
status_code,
234+
redirects: None,
235+
reason: RequestExecutionErrorReason::NonExistentSiteError {
236+
error_message: Some(error.to_string()),
237+
suggested_action: None,
238+
},
239+
};
240+
}
241+
231242
RequestExecutionError::RequestExecutionFailed {
232243
status_code,
233244
redirects: None,

0 commit comments

Comments
 (0)