summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorBen Morrison <ben@gbmor.dev>2019-09-04 13:39:15 -0400
committerBen Morrison <ben@gbmor.dev>2019-09-04 13:39:15 -0400
commit8e3e31ee2b6721ed4ccb958fefec1431372e39ba (patch)
tree701d522e69b9e883fcff8f8afb5760cb135b60a1
parente2c857a86b36c4b569698dd02323aae324f5409d (diff)
downloadclinte-8e3e31ee2b6721ed4ccb958fefec1431372e39ba.tar.gz
added helper func for errors/result
-rw-r--r--src/error.rs12
1 files changed, 12 insertions, 0 deletions
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<T, V>(res: Result<T, V>) -> T
+where
+    V: std::fmt::Debug,
+{
+    match res {
+        Ok(val) => val,
+        Err(err) => {
+            log::error!("{:?}", err);
+            panic!("{:?}", err);
+        }
+    }
+}