diff options
| author | Nathan | 2017-07-23 12:46:34 -0400 |
|---|---|---|
| committer | Nathan | 2017-07-23 12:46:34 -0400 |
| commit | 237a0be7f0ca4d7dceca1c9e43391381593064fb (patch) | |
| tree | dd4b55cc004c5ea28d1c7d4b6687de7376470ca6 /src/actions.rs | |
| parent | d1c2572a0cb2882b2661dafac0631e5888144dce (diff) | |
| download | podcast-237a0be7f0ca4d7dceca1c9e43391381593064fb.tar.bz2 | |
Cleanup and error handling
Diffstat (limited to 'src/actions.rs')
| -rw-r--r-- | src/actions.rs | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/actions.rs b/src/actions.rs index 2f90205..120d58b 100644 --- a/src/actions.rs +++ b/src/actions.rs @@ -72,8 +72,11 @@ pub fn download_range(state: &State, p_search: &str, e_search: &str) { for subscription in state.subscriptions() { if re_pod.is_match(&subscription.title()) { let podcast = Podcast::from_url(&subscription.url()).unwrap(); - let episodes_to_download = parse_download_episodes(e_search); - podcast.download_specific(episodes_to_download); + match parse_download_episodes(e_search) { + Ok(episodes_to_download) => podcast.download_specific(episodes_to_download), + Err(err) => eprintln!("{}", err), + } + return; } } } @@ -87,7 +90,7 @@ pub fn download_episode(state: &State, p_search: &str, e_search: &str) { let podcast = Podcast::from_url(&subscription.url()).unwrap(); let episodes = podcast.episodes(); if let Err(err) = episodes[episodes.len() - ep_num].download(podcast.title()) { - println!("{}", err); + eprintln!("{}", err); } } } |
