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:
parent
1c867b6028
commit
8d32f8b3f3
|
@ -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()
|
||||||
|
|
Loading…
Reference in a new issue