mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-06 07:51:47 +00:00
change type of exception when setting non-optional property to TypeError
TypeError is more correct since error occurs when user is trying to set some attribute value with None while atttribute doesn't support None type. ValueError is typically raised when provided value has a correct type but unsupported value.
This commit is contained in:
@@ -332,7 +332,7 @@ class entity_instance:
|
||||
self.wrapped_data.setArgumentAsNull(idx)
|
||||
except RuntimeError as e:
|
||||
if e.args == ("Attribute not set",):
|
||||
raise ValueError(
|
||||
raise TypeError(
|
||||
"attribute '%s' is not optional for entity instance of type '%s'"
|
||||
% (self.wrapped_data.get_argument_name(idx), self.wrapped_data.is_a(True))
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user