var errors = new Array[Error]
end
-# Error on invalid dynamic type for a deserialized attribute
-class AttributeTypeError
+# Deserialization error related to an attribute of `receiver`
+abstract class AttributeError
super Error
- autoinit receiver, attribute_name, attribute, expected_type
-
# Parent object of the problematic attribute
var receiver: Object
# Name of the problematic attribute in `receiver`
var attribute_name: String
+end
+
+# Invalid dynamic type for a deserialized attribute
+class AttributeTypeError
+ super AttributeError
+
+ autoinit receiver, attribute_name, attribute, expected_type
# Deserialized object that isn't of the `expected_type`
var attribute: nullable Object
end
end
+# Missing attribute at deserialization
+class AttributeMissingError
+ super AttributeError
+
+ autoinit receiver, attribute_name
+
+ redef var message is lazy do
+ return "Deserialization Error: Missing attribute `{receiver.class_name}::{attribute_name}`"
+ end
+end
+
# Instances of this class can be passed to `Serializer::serialize`
interface Serializable
# Serialize `self` to `serializer`