From d18766b4b420d8911a5e531c5b0cefd6073dedce Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Wed, 6 Jul 2016 18:01:00 +0200 Subject: [PATCH] Remove checking for aborting errors As the Aspect execution catches the aborting hooks and returns them, we cannot have a non-aborting error here, so there is no point in checking for aborting errors. --- libimagstore/src/store.rs | 50 ++++++++++++--------------------------- 1 file changed, 15 insertions(+), 35 deletions(-) diff --git a/libimagstore/src/store.rs b/libimagstore/src/store.rs index 1d7a3931..be284263 100644 --- a/libimagstore/src/store.rs +++ b/libimagstore/src/store.rs @@ -321,13 +321,9 @@ impl Store { pub fn create<'a, S: IntoStoreId>(&'a self, id: S) -> Result> { let id = id.into_storeid().storified(self); if let Err(e) = self.execute_hooks_for_id(self.pre_create_aspects.clone(), &id) { - if e.is_aborting() { - return Err(e) - .map_err_into(SEK::PreHookExecuteError) - .map_err_into(SEK::CreateCallError) - } else { - trace_error(&e); - } + return Err(e) + .map_err_into(SEK::PreHookExecuteError) + .map_err_into(SEK::CreateCallError) } let mut hsmap = match self.entries.write() { @@ -359,13 +355,9 @@ impl Store { pub fn retrieve<'a, S: IntoStoreId>(&'a self, id: S) -> Result> { let id = id.into_storeid().storified(self); if let Err(e) = self.execute_hooks_for_id(self.pre_retrieve_aspects.clone(), &id) { - if e.is_aborting() { - return Err(e) - .map_err_into(SEK::PreHookExecuteError) - .map_err_into(SEK::RetrieveCallError) - } else { - trace_error(&e); - } + return Err(e) + .map_err_into(SEK::PreHookExecuteError) + .map_err_into(SEK::RetrieveCallError) } self.entries @@ -466,13 +458,9 @@ impl Store { /// Return the `FileLockEntry` and write to disk pub fn update<'a>(&'a self, mut entry: FileLockEntry<'a>) -> Result<()> { if let Err(e) = self.execute_hooks_for_mut_file(self.pre_update_aspects.clone(), &mut entry) { - if e.is_aborting() { - return Err(e) - .map_err_into(SEK::PreHookExecuteError) - .map_err_into(SEK::UpdateCallError); - } else { - trace_error(&e); - } + return Err(e) + .map_err_into(SEK::PreHookExecuteError) + .map_err_into(SEK::UpdateCallError); } if let Err(e) = self._update(&entry) { @@ -533,13 +521,9 @@ impl Store { pub fn delete(&self, id: S) -> Result<()> { let id = id.into_storeid().storified(self); if let Err(e) = self.execute_hooks_for_id(self.pre_delete_aspects.clone(), &id) { - if e.is_aborting() { - return Err(e) - .map_err_into(SEK::PreHookExecuteError) - .map_err_into(SEK::DeleteCallError) - } else { - trace_error(&e); - } + return Err(e) + .map_err_into(SEK::PreHookExecuteError) + .map_err_into(SEK::DeleteCallError) } let mut entries = match self.entries.write() { @@ -618,13 +602,9 @@ impl Store { let old_id = old_id.storified(self); if let Err(e) = self.execute_hooks_for_id(self.pre_move_aspects.clone(), &old_id) { - if e.is_aborting() { - return Err(e) - .map_err_into(SEK::PreHookExecuteError) - .map_err_into(SEK::MoveByIdCallError) - } else { - trace_error(&e); - } + return Err(e) + .map_err_into(SEK::PreHookExecuteError) + .map_err_into(SEK::MoveByIdCallError) } let hsmap = self.entries.write();