HookError: Add optional non-aborting mode
This commit is contained in:
parent
59152e6a52
commit
eb80714402
1 changed files with 20 additions and 7 deletions
|
@ -1,10 +1,23 @@
|
||||||
generate_error_module!(
|
use std::convert::Into;
|
||||||
generate_error_types!(HookError, HookErrorKind,
|
generate_error_imports!();
|
||||||
|
|
||||||
|
generate_custom_error_types!(HookError, HookErrorKind, CustomData,
|
||||||
HookExecutionError => "Hook exec error",
|
HookExecutionError => "Hook exec error",
|
||||||
AccessTypeViolation => "Hook access type violation"
|
AccessTypeViolation => "Hook access type violation"
|
||||||
);
|
|
||||||
);
|
);
|
||||||
|
|
||||||
pub use self::error::HookError;
|
#[derive(Debug, Clone, Eq, PartialEq, Ord, PartialOrd, Copy)]
|
||||||
pub use self::error::HookErrorKind;
|
pub struct CustomData {
|
||||||
|
aborting: bool,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl HookError {
|
||||||
|
|
||||||
|
pub fn is_aborting(&self) -> bool {
|
||||||
|
match self.custom_data {
|
||||||
|
Some(b) => b.aborting,
|
||||||
|
None => true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue