From bdaded51a2bee8d8375182911d47377ba179140c Mon Sep 17 00:00:00 2001
From: Daniel <d.hornung@indiscale.com>
Date: Fri, 9 Dec 2022 10:36:20 +0100
Subject: [PATCH] WIP: Changed error type.

---
 src/caosdb/common/models.py | 5 ++---
 unittests/test_issues.py    | 4 ++--
 2 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/src/caosdb/common/models.py b/src/caosdb/common/models.py
index 7000ede9..ce9dbbd8 100644
--- a/src/caosdb/common/models.py
+++ b/src/caosdb/common/models.py
@@ -62,7 +62,6 @@ from caosdb.exceptions import (AmbiguousEntityError, AuthorizationError,
                                EntityDoesNotExistError, EntityError,
                                EntityHasNoDatatypeError, HTTPURITooLongError,
                                MismatchingEntitiesError, QueryNotUniqueError,
-                               ServerConfigurationException,
                                TransactionError, UniqueNamesError,
                                UnqualifiedParentsError,
                                UnqualifiedPropertiesError)
@@ -1384,8 +1383,8 @@ def _parse_value(datatype, value):
         except TypeError:
             # deal with invalid XML: List of values without appropriate datatype
             if isinstance(value, list):
-                raise ServerConfigurationException(
-                    "The server sent an invalid XML: List valued properties must be announced by "
+                raise TypeError(
+                    "Invalid datatype: List valued properties must be announced by "
                     "the datatype.\n" + f"Datatype: {datatype}\nvalue: {value}")
 
 
diff --git a/unittests/test_issues.py b/unittests/test_issues.py
index 1e649db4..1d30e011 100644
--- a/unittests/test_issues.py
+++ b/unittests/test_issues.py
@@ -34,6 +34,6 @@ def test_issue_100():
     # Parse from (invalid) XML file
     filename = os.path.join(os.path.dirname(__file__), "data", "list_in_value.xml")
     xml_el = lxml.etree.parse(filename).getroot()
-    with raises(db.ServerConfigurationException) as exc_info:
+    with raises(db.TypeError) as exc_info:
         db.common.models._parse_single_xml_element(xml_el)
-    assert "invalid XML: List valued properties" in exc_info.value.msg
+    assert "Invalid datatype: List valued properties" in exc_info.value.msg
-- 
GitLab