Add extra debug on redirects

pull/792/head
Tom Parker-Shemilt 5 years ago
parent 39b2e4b3b6
commit fd843a5dd8

@ -81,9 +81,14 @@ async fn get_url(url: String) -> (String, Result<String>) {
continue; continue;
} }
Ok(ref ok) => { Ok(ref ok) => {
if ok.status() != StatusCode::OK { let status = ok.status();
warn!("Error while getting {}, retrying: {}", url, ok.status()); if status != StatusCode::OK {
res = Err(anyhow::anyhow!("Got status code {}", ok.status())); warn!("Error while getting {}, retrying: {}", url, status);
if status.is_redirection() {
res = Err(anyhow::anyhow!("Got status code {} redirecting to {}", status, ok.headers().get(header::LOCATION).and_then(|h| h.to_str().ok()).unwrap_or("<unknown>")));
} else {
res = Err(anyhow::anyhow!("Got status code {}", status));
}
continue; continue;
} }
} }

Loading…
Cancel
Save