From ee7c5ca26e34c8b4e9e279107c49fc30b6242606 Mon Sep 17 00:00:00 2001 From: Jordan Petridis Date: Mon, 20 Nov 2017 22:23:04 +0200 Subject: [PATCH] Use bail! instead of panic!. --- hammond-downloader/src/downloader.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/hammond-downloader/src/downloader.rs b/hammond-downloader/src/downloader.rs index 2f1209a..e85e440 100644 --- a/hammond-downloader/src/downloader.rs +++ b/hammond-downloader/src/downloader.rs @@ -30,8 +30,7 @@ fn download_into(dir: &str, file_title: &str, url: &str) -> Result { 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();