aboutsummaryrefslogtreecommitdiff
path: root/src/tw/events.rs
diff options
context:
space:
mode:
authoriximeow <me@iximeow.net>2017-11-01 04:31:43 -0700
committeriximeow <me@iximeow.net>2017-11-01 04:31:43 -0700
commit96425724b0e435c33876f4dd9685aed2bbdea1fd (patch)
treedd48118f712344d5dcea278148f3c82996f74021 /src/tw/events.rs
parentc40aa2bf95131317e2a9b199afd0b34ae2d847ee (diff)
move more logging to be through DisplayInfo statuses
move DisplayInfo into ... display flush output, duh
Diffstat (limited to 'src/tw/events.rs')
-rw-r--r--src/tw/events.rs10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/tw/events.rs b/src/tw/events.rs
index 35167a3..0da27a1 100644
--- a/src/tw/events.rs
+++ b/src/tw/events.rs
@@ -22,11 +22,13 @@ impl Event {
fn get_source_target_ids(structure: serde_json::Map<String, serde_json::Value>) -> Result<(String, String), String> {
match (
structure.get("source").and_then(|x| x.get("id_str").and_then(|x| x.as_str())),
- structure.get("target_obj").and_then(|x| x.get("id_str").and_then(|x| x.as_str()))
+ structure.get("target_object").and_then(|x| x.get("id_str").and_then(|x| x.as_str()))
) {
(Some(source_id), Some(target_id)) => Ok((source_id.to_string(), target_id.to_string())),
- (None, Some(target_id)) => Err("No id_str string at .source.id_str".to_string()),
- (Some(target_id), None) => Err("No id_str string at .target_object.id_str".to_string()),
+ // have more particular error types for "missing fields", "missing data", "invalid
+ // state", etc, so downstream we can opt to investigate the bad data or not..
+ (None, Some(_)) => Err("No id_str string at .source.id_str: {}".to_string()),
+ (Some(_), None) => Err("No id_str string at .target_object.id_str: {}".to_string()),
(None, None) => Err("No id_str at source or target_object".to_string())
}
}
@@ -96,7 +98,7 @@ impl Event {
// what about removed?
// "blocked" => Blocked { },
// "unblocked" => Unblocked { },
- e => { println!("unrecognized event: {}", e); Err(e.to_string()) }
+ e => Err(e.to_string())
}
},
None => {