Add more error levels in hook execution error wrapping

This commit is contained in:
Matthias Beyer 2016-07-16 00:55:34 +02:00
parent 5a4e6b4af6
commit 8de32622b9

View file

@ -323,6 +323,7 @@ impl Store {
if let Err(e) = self.execute_hooks_for_id(self.pre_create_aspects.clone(), &id) {
return Err(e)
.map_err_into(SEK::PreHookExecuteError)
.map_err_into(SEK::HookExecutionError)
.map_err_into(SEK::CreateCallError)
}
@ -343,8 +344,9 @@ impl Store {
let mut fle = FileLockEntry::new(self, Entry::new(id));
self.execute_hooks_for_mut_file(self.post_create_aspects.clone(), &mut fle)
.map_err_into(SEK::PostHookExecuteError)
.map(|_| fle)
.map_err_into(SEK::HookExecutionError)
.map_err_into(SEK::CreateCallError)
.map(|_| fle)
}
/// Borrow a given Entry. When the `FileLockEntry` is either `update`d or
@ -357,6 +359,7 @@ impl Store {
if let Err(e) = self.execute_hooks_for_id(self.pre_retrieve_aspects.clone(), &id) {
return Err(e)
.map_err_into(SEK::PreHookExecuteError)
.map_err_into(SEK::HookExecutionError)
.map_err_into(SEK::RetrieveCallError)
}
@ -372,6 +375,7 @@ impl Store {
.map(|e| FileLockEntry::new(self, e))
.and_then(|mut fle| {
self.execute_hooks_for_mut_file(self.post_retrieve_aspects.clone(), &mut fle)
.map_err_into(SEK::PostHookExecuteError)
.map_err_into(SEK::HookExecutionError)
.and(Ok(fle))
})
@ -460,6 +464,7 @@ impl Store {
if let Err(e) = self.execute_hooks_for_mut_file(self.pre_update_aspects.clone(), &mut entry) {
return Err(e)
.map_err_into(SEK::PreHookExecuteError)
.map_err_into(SEK::HookExecutionError)
.map_err_into(SEK::UpdateCallError);
}
@ -468,7 +473,8 @@ impl Store {
}
self.execute_hooks_for_mut_file(self.post_update_aspects.clone(), &mut entry)
.map_err_into(SEK::PreHookExecuteError)
.map_err_into(SEK::PostHookExecuteError)
.map_err_into(SEK::HookExecutionError)
.map_err_into(SEK::UpdateCallError)
}
@ -523,6 +529,7 @@ impl Store {
if let Err(e) = self.execute_hooks_for_id(self.pre_delete_aspects.clone(), &id) {
return Err(e)
.map_err_into(SEK::PreHookExecuteError)
.map_err_into(SEK::HookExecutionError)
.map_err_into(SEK::DeleteCallError)
}
@ -546,7 +553,8 @@ impl Store {
}
self.execute_hooks_for_id(self.post_delete_aspects.clone(), &id)
.map_err_into(SEK::PreHookExecuteError)
.map_err_into(SEK::PostHookExecuteError)
.map_err_into(SEK::HookExecutionError)
.map_err_into(SEK::DeleteCallError)
}
@ -590,7 +598,8 @@ impl Store {
})
.map_err_into(SEK::FileError)
.and_then(|_| self.execute_hooks_for_id(self.post_move_aspects.clone(), &new_id)
.map_err_into(SEK::PostHookExecuteError))
.map_err_into(SEK::PostHookExecuteError)
.map_err_into(SEK::HookExecutionError))
.map_err_into(SEK::MoveCallError)
}
@ -604,6 +613,7 @@ impl Store {
if let Err(e) = self.execute_hooks_for_id(self.pre_move_aspects.clone(), &old_id) {
return Err(e)
.map_err_into(SEK::PreHookExecuteError)
.map_err_into(SEK::HookExecutionError)
.map_err_into(SEK::MoveByIdCallError)
}
@ -624,6 +634,7 @@ impl Store {
self.execute_hooks_for_id(self.pre_move_aspects.clone(), &new_id)
.map_err_into(SEK::PostHookExecuteError)
.map_err_into(SEK::HookExecutionError)
.map_err_into(SEK::MoveByIdCallError)
}