From 50e393675a06106bde073ccf8fabcdfd4edb5d9f Mon Sep 17 00:00:00 2001 From: Andrej730 Date: Wed, 24 May 2023 16:20:20 +0500 Subject: [PATCH] More descriptive exception for reassign_class #3192 Added it because there was no error handling here anyway and later there was another UnboundLocalError: for attribute in declaration.all_attributes(): UnboundLocalError: local variable 'declaration' referenced before assignment --- src/ifcopenshell-python/ifcopenshell/util/schema.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ifcopenshell-python/ifcopenshell/util/schema.py b/src/ifcopenshell-python/ifcopenshell/util/schema.py index 41c717ebe2..a5d545b513 100644 --- a/src/ifcopenshell-python/ifcopenshell/util/schema.py +++ b/src/ifcopenshell-python/ifcopenshell/util/schema.py @@ -68,7 +68,7 @@ def reassign_class(ifc_file, element, new_class): try: declaration = schema.declaration_by_name(new_class) except: - print(f"Class of {element} could not be changed to {new_class} as the class does not exist") + raise Exception(f"Class of {element} could not be changed to {new_class} as the class does not exist") info = element.get_info()