diff --git a/src/caosdb/common/models.py b/src/caosdb/common/models.py
index 8de67513e3adf896fbddc0914c8c4c298e71da65..4792f46caae4cdf2062ef7bc692a98f1f74d3bba 100644
--- a/src/caosdb/common/models.py
+++ b/src/caosdb/common/models.py
@@ -49,7 +49,7 @@ from caosdb.connection.encode import MultipartParam, multipart_encode
 from caosdb.exceptions import (AmbiguityException,
                                AuthorizationException,
                                CaosDBException, ConnectionException,
-                               ConsistencyError,
+                               ConsistencyError, ContainerError,
                                EntityDoesNotExistError, EntityError,
                                EntityHasNoDatatypeError,
                                TransactionError, UniqueNamesError,
diff --git a/src/caosdb/exceptions.py b/src/caosdb/exceptions.py
index 5f3b00389cb38f89d61dc0e3c7a6ef280fcf0ee7..3beec3cc14779e8ffa35d28f3fa91260b52b6645 100644
--- a/src/caosdb/exceptions.py
+++ b/src/caosdb/exceptions.py
@@ -148,12 +148,14 @@ class TransactionError(CaosDBException):
     """
 
     def __init__(self, error=None,
-                 msg="An error occured during the transaction."):
+                 msg="An error occured during the transaction.",
+                 container=None):
         self.errors = []
         self.all_errors = set()
         self.entities = []
         self.all_entities = set()
         self.msg = msg
+        self.container = container
         if error is not None:
             self.add_error(error)
 
@@ -242,6 +244,24 @@ class TransactionError(CaosDBException):
 
         return self.all_entities
 
+    def get_container(self):
+        """Return the Container object that contained the problematic
+        entities.  
+
+        Returns
+        -------
+        Container
+            Either the container that caused this error (which
+            contains at least one faulty entity) or, if none was given
+            during construction, a new container containing
+            self.entities instead.
+
+        """
+        if self.container is not None:
+            return self.container
+        from caosdb import Container
+        return Container().extend(self.entities)
+
     def get_error(self):
         """If this Transaction error was caused by exactly one EntityError,
         return this error. Raise an AmbiguityException otherwise.
@@ -382,14 +402,3 @@ class AuthorizationException(EntityError):
     Maybe you need more privileges or a user account at all.
 
     """
-
-
-class ContainerError(EntityError):
-    """The container contains one or more entities that caused errors."""
-    def _repr_head(self, indent):
-        if hasattr(self, "entity") and self.entity is not None:
-            return (str(type(self.entity).__name__).upper() +
-                    " CAUSED " +
-                    TransactionError._repr_head(self, indent))
-        else:
-            return TransactionError._repr_head(self, indent)