diff --git a/libimagstore/src/hook/aspect.rs b/libimagstore/src/hook/aspect.rs index a0181971..08ecb914 100644 --- a/libimagstore/src/hook/aspect.rs +++ b/libimagstore/src/hook/aspect.rs @@ -5,6 +5,9 @@ use hook::result::HookResult; use hook::accessor::{StoreIdAccessor, MutableHookDataAccessor, NonMutableHookDataAccessor}; use hook::accessor::HookDataAccessor as HDA; +use hook::error::HookError as HE; +use hook::error::HookErrorKind as HEK; + #[derive(Debug)] pub struct Aspect { name: String, @@ -36,12 +39,9 @@ impl StoreIdAccessor for Aspect { use std::thread; use std::thread::JoinHandle; - use hook::error::HookError as HE; - use hook::error::HookErrorKind as HEK; - let accessors : Vec = self.hooks.iter().map(|h| h.accessor()).collect(); if !accessors.iter().all(|a| match a { &HDA::StoreIdAccess(_) => true, _ => false }) { - unimplemented!() + return Err(HE::new(HEK::AccessTypeViolation, None)); } let threads : Vec> = accessors @@ -74,7 +74,7 @@ impl MutableHookDataAccessor for Aspect { fn access_mut(&self, fle: &mut FileLockEntry) -> HookResult<()> { let accessors : Vec = self.hooks.iter().map(|h| h.accessor()).collect(); if !accessors.iter().all(|a| match a { &HDA::MutableAccess(_) => true, _ => false }) { - unimplemented!() + return Err(HE::new(HEK::AccessTypeViolation, None)); } for accessor in accessors { @@ -93,12 +93,9 @@ impl NonMutableHookDataAccessor for Aspect { use std::thread; use std::thread::JoinHandle; - use hook::error::HookError as HE; - use hook::error::HookErrorKind as HEK; - let accessors : Vec = self.hooks.iter().map(|h| h.accessor()).collect(); if !accessors.iter().all(|a| match a { &HDA::NonMutableAccess(_) => true, _ => false }) { - unimplemented!() + return Err(HE::new(HEK::AccessTypeViolation, None)); } let threads : Vec> = accessors diff --git a/libimagstore/src/hook/error.rs b/libimagstore/src/hook/error.rs index fd0683aa..c491b83a 100644 --- a/libimagstore/src/hook/error.rs +++ b/libimagstore/src/hook/error.rs @@ -10,6 +10,7 @@ use std::convert::Into; #[derive(Clone, Copy, Debug)] pub enum HookErrorKind { HookExecutionError, + AccessTypeViolation, Pre(PreHookErrorKind), Post(PostHookErrorKind) }