aboutsummaryrefslogtreecommitdiff
path: root/src/commands/fav.rs
diff options
context:
space:
mode:
authorAndy Wortman <ixineeringeverywhere@gmail.com>2017-11-01 04:31:43 -0700
committerAndy Wortman <ixineeringeverywhere@gmail.com>2017-11-01 04:31:43 -0700
commit41f6535a480bb9b0ff085e0144852827633f2305 (patch)
treedd48118f712344d5dcea278148f3c82996f74021 /src/commands/fav.rs
parentbf7f5d32a7f05bb0a7bc19dcb443d3df439243ba (diff)
move more logging to be through DisplayInfo statuses
move DisplayInfo into ... display flush output, duh
Diffstat (limited to 'src/commands/fav.rs')
-rw-r--r--src/commands/fav.rs14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/commands/fav.rs b/src/commands/fav.rs
index 89e1987..6109310 100644
--- a/src/commands/fav.rs
+++ b/src/commands/fav.rs
@@ -19,13 +19,16 @@ fn unfav(line: String, tweeter: &mut tw::TwitterCache, queryer: &mut Queryer) {
match maybe_id {
Ok(twid) => {
if let Some(twete) = tweeter.retrieve_tweet(&twid).map(|x| x.clone()) { // TODO: no clone when this stops taking &mut self
- queryer.do_api_post(&format!("{}?id={}", UNFAV_TWEET_URL, twete.id));
+ match queryer.do_api_post(&format!("{}?id={}", UNFAV_TWEET_URL, twete.id)) {
+ Ok(_) => (),
+ Err(e) => tweeter.display_info.status(e)
+ }
} 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));
}
}
}
@@ -42,13 +45,16 @@ fn fav(line: String, tweeter: &mut tw::TwitterCache, queryer: &mut Queryer) {
Ok(twid) => {
// tweeter.to_twitter_tweet_id(twid)...
if let Some(twete) = tweeter.retrieve_tweet(&twid).map(|x| x.clone()) { // TODO: no clone when this stops taking &mut self
- queryer.do_api_post(&format!("{}?id={}", FAV_TWEET_URL, twete.id));
+ match queryer.do_api_post(&format!("{}?id={}", FAV_TWEET_URL, twete.id)) {
+ Ok(_) => (),
+ Err(e) => tweeter.display_info.status(e)
+ }
} 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));
}
}
}