Open GoogleCodeExporter opened 9 years ago
Actully FromClass does not help for me. I added release in the AsType method as:
function TSuperRttiContext.AsType<T>(const obj: ISuperObject): T;
var
ret: TValue;
begin
if FromJson(TypeInfo(T), obj, ret) then
Result := ret.AsType<T>
else
begin
if ret.Kind = tkClass then
ret.AsObject.Free;
raise Exception.Create('Marshalling error');
end;
end;
(not sure if it's safe...)
Original comment by Zigmund....@gmail.com
on 24 Feb 2014 at 4:44
And more thing. You use "raise Exception.Create('')" - not a best idea. Can you
type your exception with some base exception class so that other can filter out
the excpetion by it's type and not just exception..
ESuperException = class(Exception) will be enough..
Much better when handling errors.
Original comment by Zigmund....@gmail.com
on 24 Feb 2014 at 4:46
Original issue reported on code.google.com by
Zigmund....@gmail.com
on 24 Feb 2014 at 4:38