HookError: Add optional non-aborting mode

This commit is contained in:
Matthias Beyer 2016-04-18 17:11:56 +02:00
parent 59152e6a52
commit eb80714402

View file

@ -1,10 +1,23 @@
generate_error_module!(
generate_error_types!(HookError, HookErrorKind,
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
}
}
}