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()
|
||||
.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()
|
||||
|
|
Loading…
Reference in a new issue