From 5f7fea874c4dbbf7352638e504ce7892f4de2509 Mon Sep 17 00:00:00 2001
From: florian <f.spreckelsen@inidscale.com>
Date: Tue, 7 Jul 2020 14:55:29 +0200
Subject: [PATCH] BUG: only raise error if any was found

---
 src/caosdb/common/models.py | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/src/caosdb/common/models.py b/src/caosdb/common/models.py
index 6f134ea8..711f3f94 100644
--- a/src/caosdb/common/models.py
+++ b/src/caosdb/common/models.py
@@ -2734,8 +2734,10 @@ class Container(list):
                             description="This entity has no identifier. It cannot be retrieved."))
 
                     if raise_exception_on_error:
-                        raise EntityError(
-                            "This entity has no identifier. It cannot be retrieved.", entity)
+                        ee = EntityError(
+                            "This entity has no identifier. It cannot be retrieved.",
+                            entity)
+                        raise TransactionError(ee) 
                     else:
                         entity.is_valid = lambda: False
         else:
@@ -3791,7 +3793,9 @@ def raise_errors(arg0):
     """
     transaction_error = _evaluate_and_add_error(TransactionError(),
                                                 arg0)
-    raise transaction_error
+    # Raise if any error was found
+    if len(transaction_error.all_errors) > 0:
+        raise transaction_error
 
 
 def delete(ids, raise_exception_on_error=True):
-- 
GitLab