lib/plug_ca_inqueue.js
function(error, cb) {
            var doShutdown = function() {
                var cb0 = function(err0) {
                    if (err0) {
                        $._.$.log &&
                            $._.$.log.fatal('handleError: Critical shutdown' +
                                            ' failed, exiting '
                                            + myUtils.errToPrettyStr(err0));
                         // critical shutdown failed
                        process.exit(1);
                    } else {
                        cb(null, json_rpc.reply(error));
                    }
                };
                $.ca.__ca_shutdown__(null, cb0);
            };

            var doAbort = function() {
                var cb0 = function(err0) {
                    if (err0) {
                        // abort failed, try something more drastic
                        $._.$.log &&
                            $._.$.log.error('handleError: Error in abort, ' +
                                            'force shutdown '
                                            + myUtils.errToPrettyStr(err0));
                        doShutdown();
                    } else {
                        cb(null, json_rpc.reply(error));
                    }
                };
                $.ca.__ca_abort__(cb0);
            };

            if (error.name === 'AppError') {
                $._.$.log && $._.$.log.trace('handleError: AppError aborting: '
                                             + myUtils.errToPrettyStr(error));
                doAbort();
            } else if (error.name === 'SystemError') {
                if ((error.code === ERROR_CODES.commitFailure) ||
                    (error.code === ERROR_CODES.checkpointFailure)) {
                    /* Error while committing or persisting the commit decision.
                     *
                     * Not enough to abort, force a CA shutdown.
                     *
                     * When this CA recovers from the shutdown,
                     * if the checkpoint made it to persistent
                     * storage it will redo the commit actions (*always* assumed
                     *  to be idempotent).
                     *
                     * We cannot imply that `checkpointFailure` means it did
                     * not make it to storage. That's the reason
                     * we have to shutdown, because it may have been logged as
                     * pending to be committed...
                     */
                    $._.$.log &&
                        $._.$.log.debug('handleError: SysError shutdown CA: '
                                        + myUtils.errToPrettyStr(error));
                    doShutdown();
                } else {
                    $._.$.log &&
                        $._.$.log.debug('handleError: SysError aborting: '
                                        + myUtils.errToPrettyStr(error));
                    doAbort();
                }
            } else {
                // This is a bug, all the errors should be App or System by now.
                var msg = (error && (typeof error === 'object' ?
                                     myUtils.errToPrettyStr(error) :
                                     JSON.stringify(error)));
                $._.$.log && $._.$.log.fatal('handleError: error is neither'
                                             + ' App or System ' + msg);
                process.exit(1);
            }
        }
function(error, cb) {
            var doShutdown = function() {
                var cb0 = function(err0) {
                    if (err0) {
                        $._.$.log &&
                            $._.$.log.fatal('handleError: Critical shutdown' +
                                            ' failed, exiting '
                                            + myUtils.errToPrettyStr(err0));
                         // critical shutdown failed
                        process.exit(1);
                    } else {
                        cb(null, json_rpc.reply(error));
                    }
                };
                $.ca.__ca_shutdown__(null, cb0);
            };

            var doAbort = function() {
                var cb0 = function(err0) {
                    if (err0) {
                        // abort failed, try something more drastic
                        $._.$.log &&
                            $._.$.log.error('handleError: Error in abort, ' +
                                            'force shutdown '
                                            + myUtils.errToPrettyStr(err0));
                        doShutdown();
                    } else {
                        cb(null, json_rpc.reply(error));
                    }
                };
                $.ca.__ca_abort__(cb0);
            };

            if (error.name === 'AppError') {
                $._.$.log && $._.$.log.trace('handleError: AppError aborting: '
                                             + myUtils.errToPrettyStr(error));
                doAbort();
            } else if (error.name === 'SystemError') {
                if ((error.code === ERROR_CODES.commitFailure) ||
                    (error.code === ERROR_CODES.checkpointFailure)) {
                    /* Error while committing or persisting the commit decision.
                     *
                     * Not enough to abort, force a CA shutdown.
                     *
                     * When this CA recovers from the shutdown,
                     * if the checkpoint made it to persistent
                     * storage it will redo the commit actions (*always* assumed
                     *  to be idempotent).
                     *
                     * We cannot imply that `checkpointFailure` means it did
                     * not make it to storage. That's the reason
                     * we have to shutdown, because it may have been logged as
                     * pending to be committed...
                     */
                    $._.$.log &&
                        $._.$.log.debug('handleError: SysError shutdown CA: '
                                        + myUtils.errToPrettyStr(error));
                    doShutdown();
                } else {
                    $._.$.log &&
                        $._.$.log.debug('handleError: SysError aborting: '
                                        + myUtils.errToPrettyStr(error));
                    doAbort();
                }
            } else {
                // This is a bug, all the errors should be App or System by now.
                var msg = (error && (typeof error === 'object' ?
                                     myUtils.errToPrettyStr(error) :
                                     JSON.stringify(error)));
                $._.$.log && $._.$.log.fatal('handleError: error is neither'
                                             + ' App or System ' + msg);
                process.exit(1);
            }
        }
/*
See that.process()