2016-04-18 15:11:56 +00:00
|
|
|
use std::convert::Into;
|
|
|
|
generate_error_imports!();
|
|
|
|
|
|
|
|
generate_custom_error_types!(HookError, HookErrorKind, CustomData,
|
|
|
|
HookExecutionError => "Hook exec error",
|
2016-07-06 17:09:58 +00:00
|
|
|
AccessTypeViolation => "Hook access type violation",
|
|
|
|
MutableHooksNotAllowed => "Mutable Hooks are denied"
|
2016-05-15 14:41:25 +00:00
|
|
|
);
|
2016-03-04 15:43:01 +00:00
|
|
|
|
2016-04-18 15:11:56 +00:00
|
|
|
#[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
|
|
|
|
}
|
|
|
|
}
|
2016-05-27 08:15:29 +00:00
|
|
|
|
2016-04-18 15:11:56 +00:00
|
|
|
}
|