main.js
function (execPlan, error, stderr, errorHandler) {
    var shouldContinue      = execPlan.continuesOnError(); // default to using configured policy
    var errorHandlerDefined = utils.isFunction(errorHandler);
    var errorHandlerReturn;
    var shouldOverridePolicy; // whether the given error handler is overriding the
                              // "continue on error" policy already set on the exec plan
    
    // determine whether the "continue on error" policy should be overridden by the given error
    // error handler. this is determined by whether the given error handler returns either true
    // or false. any other return, e.g., undefined, will signify that the policy should be used.
    if (errorHandlerDefined) errorHandlerReturn = errorHandler(error, stderr);
    shouldOverridePolicy = ((errorHandlerReturn === true) || (errorHandlerReturn === false));
    if (shouldOverridePolicy) {
        shouldContinue = errorHandlerReturn;
    } else {  // not overriding the policy has the side-effect of allowing 'execerror' to fire
        execPlan.emit('execerror', error, stderr);
    }

    return shouldContinue;
}
function (execPlan, error, stderr, errorHandler) {
    var shouldContinue      = execPlan.continuesOnError(); // default to using configured policy
    var errorHandlerDefined = utils.isFunction(errorHandler);
    var errorHandlerReturn;
    var shouldOverridePolicy; // whether the given error handler is overriding the
                              // "continue on error" policy already set on the exec plan
    
    // determine whether the "continue on error" policy should be overridden by the given error
    // error handler. this is determined by whether the given error handler returns either true
    // or false. any other return, e.g., undefined, will signify that the policy should be used.
    if (errorHandlerDefined) errorHandlerReturn = errorHandler(error, stderr);
    shouldOverridePolicy = ((errorHandlerReturn === true) || (errorHandlerReturn === false));
    if (shouldOverridePolicy) {
        shouldContinue = errorHandlerReturn;
    } else {  // not overriding the policy has the side-effect of allowing 'execerror' to fire
        execPlan.emit('execerror', error, stderr);
    }

    return shouldContinue;
}
function ( execPlan , error , stderr , errorHandler ) { var shouldContinue = execPlan . continuesOnError ( ) ; // default to using configured policy var errorHandlerDefined = utils . isFunction ( errorHandler ) ; var errorHandlerReturn ; var shouldOverridePolicy ; // whether the given error handler is overriding the // "continue on error" policy already set on the exec plan // determine whether the "continue on error" policy should be overridden by the given error // error handler. this is determined by whether the given error handler returns either true // or false. any other return, e.g., undefined, will signify that the policy should be used. if ( errorHandlerDefined ) errorHandlerReturn = errorHandler ( error , stderr ) ; shouldOverridePolicy = ( ( errorHandlerReturn === true ) || ( errorHandlerReturn === false ) ) ; if ( shouldOverridePolicy ) { shouldContinue = errorHandlerReturn ; } else { // not overriding the policy has the side-effect of allowing 'execerror' to fire execPlan . emit ( 'execerror' , error , stderr ) ; } return shouldContinue ; }
Provide a common handler for errors that occur during the execution of a plan.
@param execPlan ExecPlan
@param error Error
@param stderr String
@param errorHandler Function
@param error Error
@param stderr String
@return Boolean - whether the plan should continue to execute
Provide a common handler for errors that occur during the execution of a plan .