Use bail! instead of panic!.
This commit is contained in:
parent
7be0b5bbf8
commit
ee7c5ca26e
@ -30,8 +30,7 @@ fn download_into(dir: &str, file_title: &str, url: &str) -> Result<String> {
|
|||||||
info!("Status Resp: {}", resp.status());
|
info!("Status Resp: {}", resp.status());
|
||||||
|
|
||||||
if !resp.status().is_success() {
|
if !resp.status().is_success() {
|
||||||
// TODO: Return an error instead of panicking.
|
bail!("Unexpected server response: {}", resp.status())
|
||||||
panic!("Bad request response.");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let headers = resp.headers().clone();
|
let headers = resp.headers().clone();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user