Add interface for custom error data type
This commit is contained in:
parent
3ee8f26d1e
commit
b81750ba09
1 changed files with 21 additions and 0 deletions
|
@ -1,4 +1,6 @@
|
|||
use std::convert::Into;
|
||||
use std::default::Default;
|
||||
|
||||
generate_error_imports!();
|
||||
|
||||
generate_custom_error_types!(HookError, HookErrorKind, CustomData,
|
||||
|
@ -12,6 +14,25 @@ pub struct CustomData {
|
|||
aborting: bool,
|
||||
}
|
||||
|
||||
impl CustomData {
|
||||
|
||||
pub fn aborting(mut self, b: bool) -> CustomData {
|
||||
self.aborting = b;
|
||||
self
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
impl Default for CustomData {
|
||||
|
||||
fn default() -> CustomData {
|
||||
CustomData {
|
||||
aborting: true
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
impl HookError {
|
||||
|
||||
pub fn is_aborting(&self) -> bool {
|
||||
|
|
Loading…
Reference in a new issue