Use bail! instead of panic!.

This commit is contained in:
Jordan Petridis 2017-11-20 22:23:04 +02:00
parent 7be0b5bbf8
commit ee7c5ca26e
No known key found for this signature in database
GPG Key ID: CEABAD9F5683B9A6

View File

@ -30,8 +30,7 @@ fn download_into(dir: &str, file_title: &str, url: &str) -> Result<String> {
info!("Status Resp: {}", resp.status());
if !resp.status().is_success() {
// TODO: Return an error instead of panicking.
panic!("Bad request response.");
bail!("Unexpected server response: {}", resp.status())
}
let headers = resp.headers().clone();