diff options
author | Andy Wortman <ixineeringeverywhere@gmail.com> | 2017-10-25 04:07:32 -0700 |
---|---|---|
committer | Andy Wortman <ixineeringeverywhere@gmail.com> | 2017-10-25 04:07:32 -0700 |
commit | ccccc6e1b2ebd62a35715f71c746f3a3b9c0b97e (patch) | |
tree | 8bb44e53dab2a9b5f94284ca0f390061032eb4f1 /src/commands/thread.rs | |
parent | 580f44092358cc260db00ec9871caecac62de361 (diff) |
begin removing unwrap()
Diffstat (limited to 'src/commands/thread.rs')
-rw-r--r-- | src/commands/thread.rs | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/commands/thread.rs b/src/commands/thread.rs index fd491ba..8880af7 100644 --- a/src/commands/thread.rs +++ b/src/commands/thread.rs @@ -33,12 +33,15 @@ fn remember(line: String, tweeter: &mut tw::TwitterCache, _queryer: &mut Queryer let maybe_id = TweetId::parse(line.to_owned()); match maybe_id { Ok(twid) => { - let twete = tweeter.retrieve_tweet(&twid).unwrap().clone(); - tweeter.set_thread(name.to_string(), twete.internal_id); - println!("Ok! Recorded {:?} as thread {}", twid, name); + if let Some(twete) = tweeter.retrieve_tweet(&twid).map(|x| x.clone()) { + tweeter.set_thread(name.to_string(), twete.internal_id); + tweeter.display_info.status(format!("Ok! Recorded {:?} as thread {}", twid, name)); + } else { + tweeter.display_info.status(format!("No tweet for id: {:?}", twid)); + } } Err(e) => { - println!("Invalid id: {}", e); + tweeter.display_info.status(format!("Invalid id: {}", e)); } } } |