diff --git a/src/caosdb/common/datatype.py b/src/caosdb/common/datatype.py index c6468c0f11dac22745cf4ebeed18dac09c15600e..eb8c1e4e0088f1924940a104ec3916b9d5d40f99 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