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:
Andrej730
2024-06-03 12:25:05 +05:00
parent d53351d218
commit 5ccdf187d5
@@ -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))
)