From 8e3e31ee2b6721ed4ccb958fefec1431372e39ba Mon Sep 17 00:00:00 2001 From: Ben Morrison Date: Wed, 4 Sep 2019 13:39:15 -0400 Subject: added helper func for errors/result --- src/error.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 src/error.rs diff --git a/src/error.rs b/src/error.rs new file mode 100644 index 0000000..3265271 --- /dev/null +++ b/src/error.rs @@ -0,0 +1,12 @@ +pub fn helper(res: Result) -> T +where + V: std::fmt::Debug, +{ + match res { + Ok(val) => val, + Err(err) => { + log::error!("{:?}", err); + panic!("{:?}", err); + } + } +} -- cgit 1.4.1-2-gfad0