diff options
author | Andy Wortman <ixineeringeverywhere@gmail.com> | 2017-11-01 04:31:43 -0700 |
---|---|---|
committer | Andy Wortman <ixineeringeverywhere@gmail.com> | 2017-11-01 04:31:43 -0700 |
commit | 41f6535a480bb9b0ff085e0144852827633f2305 (patch) | |
tree | dd48118f712344d5dcea278148f3c82996f74021 /src/tw/events.rs | |
parent | bf7f5d32a7f05bb0a7bc19dcb443d3df439243ba (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.rs | 10 |
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 => { |