Orange check failling all of a sudden
Jacob Carlborg
doob at me.com
Tue Jun 19 11:58:35 UTC 2018
On 2018-06-13 02:31, DigitalDesigns wrote:
> Also, is there any way to have a field as optional? Right now when I
> update a filed in a serialized type the app crashes because it can't
> find the field in the serialized data(since it was just added in the
> code). This requires either regenerating the data or manually adding the
> serialized field to each entry... both are impractical.
The only way would be to implement the serialization yourself, i.e.
implement `toData` and `fromData`, but I don't think there's a way to
check if a field is present in the serialized data. So it might not be
so easy.
> It would be nice to disable missing fields from throwing. While I could
> catch one error it would be a pain to try and catch an arbitrary number
> of them.
You can set the "errorCallback" [1] to an empty delegate or whatever you
see fit. But this callback will be called for other errors as well.
> Maybe an attribute is better used:
>
> @allowDefaultSerialized
[1]
https://github.com/jacob-carlborg/orange/blob/master/orange/serialization/Serializer.d#L133
--
/Jacob Carlborg
More information about the Digitalmars-d-learn
mailing list