summaryrefslogtreecommitdiffstats
path: root/libimagstore
diff options
context:
space:
mode:
authorMatthias Beyer <mail@beyermatthias.de>2016-04-18 17:11:56 +0200
committerMatthias Beyer <mail@beyermatthias.de>2016-05-28 21:08:07 +0200
commiteb8071440218a83a6bc95b52dc5d9b409a8da055 (patch)
tree673b1eacfb22df7c3a05ad2612b7833c91d8972e /libimagstore
parent59152e6a52ce742142c3fbee8386a517402c56a2 (diff)
HookError: Add optional non-aborting mode
Diffstat (limited to 'libimagstore')
-rw-r--r--libimagstore/src/hook/error.rs27
1 files changed, 20 insertions, 7 deletions
diff --git a/libimagstore/src/hook/error.rs b/libimagstore/src/hook/error.rs
index afe9ef07..77095844 100644
--- a/libimagstore/src/hook/error.rs
+++ b/libimagstore/src/hook/error.rs
@@ -1,10 +1,23 @@
-generate_error_module!(
- generate_error_types!(HookError, HookErrorKind,
- HookExecutionError => "Hook exec error",
- AccessTypeViolation => "Hook access type violation"
- );
+use std::convert::Into;
+generate_error_imports!();
+
+generate_custom_error_types!(HookError, HookErrorKind, CustomData,
+ HookExecutionError => "Hook exec error",
+ AccessTypeViolation => "Hook access type violation"
);
-pub use self::error::HookError;
-pub use self::error::HookErrorKind;
+#[derive(Debug, Clone, Eq, PartialEq, Ord, PartialOrd, Copy)]
+pub struct CustomData {
+ aborting: bool,
+}
+
+impl HookError {
+
+ pub fn is_aborting(&self) -> bool {
+ match self.custom_data {
+ Some(b) => b.aborting,
+ None => true
+ }
+ }
+}