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() .send()
.and_then(|res| res.error_for_status()) .and_then(|res| res.error_for_status())
.map_err(|e| { .map_err(|e| {
format!( match e.status() {
"Failed to request {}: {}", Some(status) => format!("Failed to request {}: {}", url, status),
url, None => format!("Could not get response status for url: {}", url),
e.status().expect("response status") }
)
})?; })?;
response response
.text() .text()