From f2e2198897dfe1d0716f7cba757b5e89687da119 Mon Sep 17 00:00:00 2001
From: florian <f.spreckelsen@inidscale.com>
Date: Tue, 22 Sep 2020 11:16:38 +0200
Subject: [PATCH] API: Use BadQueryErrors in datatype.py

---
 src/caosdb/common/datatype.py | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/src/caosdb/common/datatype.py b/src/caosdb/common/datatype.py
index c6468c0f..eb8c1e4e 100644
--- a/src/caosdb/common/datatype.py
+++ b/src/caosdb/common/datatype.py
@@ -25,8 +25,7 @@
 
 import re
 
-from ..exceptions import (AmbiguityException, EntityDoesNotExistError,
-                          TransactionError)
+from ..exceptions import EmptyUniqueQueryError, QueryNotUniqueError
 
 DOUBLE = "DOUBLE"
 REFERENCE = "REFERENCE"
@@ -92,9 +91,9 @@ def get_id_of_datatype(datatype):
 
     Raises
     ------
-    AmbiguityException
+    QueryNotUniqueError
         If there are more than one entities with the same name as the datatype.
-    EntityDoesNotExistError
+    EmptyUniqueQueryError
         If there is no entity with the name of the datatype.
     """
     from caosdb import execute_query
@@ -108,12 +107,11 @@ def get_id_of_datatype(datatype):
     res = [el for el in res if el.name.lower() == datatype.lower()]
 
     if len(res) > 1:
-        raise AmbiguityException(
+        raise QueryNotUniqueError(
             "Name {} did not lead to unique result; Missing "
             "implementation".format(datatype))
     elif len(res) != 1:
-        ee = EntityDoesNotExistError(
+        raise EmptyUniqueQueryError(
             "No RecordType named {}".format(datatype))
-        raise TransactionError(ee)
 
     return res[0].id
-- 
GitLab