The doco is a bit lacking in how to alter results or manipulate the context of the method. Typically with my logs, I like to collect a object of data at the top level and then at the end of the call or with a exception, the whole call gets printed as one transaction. If I have an object, how would I reference this in a afterMethod hook to log it?
However, currently if the original method throws an error, after hooks are not called. I could modify this, but I don’t really know what would be the best behavior in this case.
Maybe something like:
Meteor.afterMethods('test',function(inputA,inputB,result){
return result+1;
}, function(inputA,inputB,error){
//Called when an error occurs
});