You are not logged in.
Pages: 1
JSONToObject will fail if it encounters invalid enumaration (-1) when reading previously saved object.
example:
tkEnumeration: begin
if wasString then begin // in case enum stored as string
V := P^.PropType^.EnumBaseType^.GetEnumNameValue(PropValue);
if V<0 then
exit;
However ObjectToJSON does save object with such enum and that can be potentially dangerous since object is left in inconsistent state (half loaded) and if that object contains child objects they could be partly loaded.
My suggestion is to either:
a) introduce j2oIgnoreUnknownEnum to TJSONToObjectOption and simply continue loading of such object
b) recursively go up to list of created objects and delete them all (not just the last offending one). This could be useful for other fail situations as well, when object is only partially loaded. This of course could be configurable.
Offline
I've implemented suggestion a).
See http://synopse.info/fossil/info/bc96e7fb50
Thanks for the feedback!
Offline
Wow, that was fast
Thank you very much for this and whole mORMot you've been doing.
Offline
Pages: 1