FAQ: Returning value vs. wrapReturn - TheOpenCloudEngine/metaworks GitHub Wiki

When you change returning value to MetaworksRemoteService.wrapReturn, be careful not to change the flow control. Since wrapReturn doesn't make the flow exit from the routine(method), simply changing return statement to wrapReturn will make undesired flow control. See example:

if(someCondition) return new ToAppend(object);

return object;

is not equivalent to this:

if(someCondition) wrapReturn(new ToAppend(object));

wrapReturn(object);

The latter code will overwrite the wrapReturn value to object finally.