Fix panic in load_data(url=%s) (#1036)

If there is no response from the server, `load_data` would panic
with: `response status`.

This patch removes the `expect` in favor of an error message that we
couldn't get a response from the server for a given url.
This commit is contained in:
Stan Rozenraukh 2020-05-25 03:25:41 -04:00 committed by GitHub
parent 1c867b6028
commit 8d32f8b3f3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -210,11 +210,10 @@ impl TeraFn for LoadData {
.send()
.and_then(|res| res.error_for_status())
.map_err(|e| {
format!(
"Failed to request {}: {}",
url,
e.status().expect("response status")
)
match e.status() {
Some(status) => format!("Failed to request {}: {}", url, status),
None => format!("Could not get response status for url: {}", url),
}
})?;
response
.text()