src/courier/PostMessageCourier.js
function _handleReturnMessage(id, method) {
                var callback = this.callbackCache.get(id, true);
                var args = method && method.args;

                if ("function" === typeof callback) {
                    // First try to parse the first parameter in case the error is an object
                    if (args && args.length && args[0] && "Error" === args[0].type && "string" === typeof args[0].message) {
                        args[0] = new Error(args[0].message);
                    }

                    try {
                        callback.apply(null, args);
                    }
                    catch (ex) {
                        PostMessageUtilities.log("Error while trying to handle the returned message from request/command", "ERROR", "PostMessageCourier");
                    }
                }
            }
function _handleReturnMessage(id, method) {
                var callback = this.callbackCache.get(id, true);
                var args = method && method.args;

                if ("function" === typeof callback) {
                    // First try to parse the first parameter in case the error is an object
                    if (args && args.length && args[0] && "Error" === args[0].type && "string" === typeof args[0].message) {
                        args[0] = new Error(args[0].message);
                    }

                    try {
                        callback.apply(null, args);
                    }
                    catch (ex) {
                        PostMessageUtilities.log("Error while trying to handle the returned message from request/command", "ERROR", "PostMessageCourier");
                    }
                }
            }
function _handleReturnMessage ( id , method ) { var callback = this . callbackCache . get ( id , true ) ; var args = method && method . args ; if ( "function" === typeof callback ) { // First try to parse the first parameter in case the error is an object if ( args && args . length && args [ 0 ] && "Error" === args [ 0 ] . type && "string" === typeof args [ 0 ] . message ) { args [ 0 ] = new Error ( args [ 0 ] . message ) ; } try { callback . apply ( null , args ) ; } catch ( ex ) { PostMessageUtilities . log ( "Error while trying to handle the returned message from request/command" , "ERROR" , "PostMessageCourier" ) ; } } }
Method for handling return messages from the callee
@param {String} id - the id of the callback
@param {Object} method - the method object with needed args
@private
Method for handling return messages from the callee