Cant Modify Immutable Attribute Error¶
cant_modify_immutable_attribute_error
¶
Error raised when code attempts to mutate a frozen or immutable attribute.
Defines CantModifyImmutableAttributeError, raised when an attempt is made
to set or delete an attribute on a value object or entity that has been frozen
by @auto_freeze. Extends RuntimeErrorMixin and Error[str],
making it catchable as both RuntimeError and Exception.
CantModifyImmutableAttributeError
¶
Bases: RuntimeErrorMixin, Error[str]
Raised when there is an attempt to modify an immutable attribute of an object.
Example
Source code in src/forging_blocks/foundation/errors/cant_modify_immutable_attribute_error.py
__init__(class_name: str, attribute_name: str)
¶
Initialise the error with the class and attribute that triggered the violation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
class_name
|
str
|
Name of the class whose immutable attribute was targeted. |
required |
attribute_name
|
str
|
Name of the attribute that was being modified. |
required |