mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-28 07:49:59 +00:00
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
This commit is contained in:
@@ -68,7 +68,7 @@ def reassign_class(ifc_file, element, new_class):
|
|||||||
try:
|
try:
|
||||||
declaration = schema.declaration_by_name(new_class)
|
declaration = schema.declaration_by_name(new_class)
|
||||||
except:
|
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()
|
info = element.get_info()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user