lib/ca_main.js
function(err, result) {
                        if (err) {
                            cb0(err);
                        } else {
                            var retErr = null;
                            /*
                             * Errors during init or resume are mapped to
                             *  system or app errors that abort initialization.
                             *
                             * This is not enough, it leaves the CA in an
                             * uninitialized state, and errors get ignored.
                             *
                             * Instead we need to shutdown the CA, and propagate
                             * errors in the callback.
                             */
                            if (json_rpc.isSystemError(result) ||
                                (json_rpc.getAppReplyError(result))) {
                                retErr = result;
                            }
                            async.series([
                                function(cb2) {
                                    if (retErr) {
                                        that.__ca_shutdown__(null, cb2);
                                    } else {
                                        cb2(null);
                                    }
                                }
                            ], function(errIgnore) {
                                // ignore shutdown failure
                                if (errIgnore) {
                                    retErr.shutdownError = errIgnore;
                                }
                                cb0(retErr, result);
                            });
                        }
                    }
function(err, result) {
                        if (err) {
                            cb0(err);
                        } else {
                            var retErr = null;
                            /*
                             * Errors during init or resume are mapped to
                             *  system or app errors that abort initialization.
                             *
                             * This is not enough, it leaves the CA in an
                             * uninitialized state, and errors get ignored.
                             *
                             * Instead we need to shutdown the CA, and propagate
                             * errors in the callback.
                             */
                            if (json_rpc.isSystemError(result) ||
                                (json_rpc.getAppReplyError(result))) {
                                retErr = result;
                            }
                            async.series([
                                function(cb2) {
                                    if (retErr) {
                                        that.__ca_shutdown__(null, cb2);
                                    } else {
                                        cb2(null);
                                    }
                                }
                            ], function(errIgnore) {
                                // ignore shutdown failure
                                if (errIgnore) {
                                    retErr.shutdownError = errIgnore;
                                }
                                cb0(retErr, result);
                            });
                        }
                    }
function ( err , result ) { if ( err ) { cb0 ( err ) ; } else { var retErr = null ; /*
                             * Errors during init or resume are mapped to
                             *  system or app errors that abort initialization.
                             *
                             * This is not enough, it leaves the CA in an
                             * uninitialized state, and errors get ignored.
                             *
                             * Instead we need to shutdown the CA, and propagate
                             * errors in the callback.
                             */ if ( json_rpc . isSystemError ( result ) || ( json_rpc . getAppReplyError ( result ) ) ) { retErr = result ; } async . series ( [ function ( cb2 ) { if ( retErr ) { that . __ca_shutdown__ ( null , cb2 ) ; } else { cb2 ( null ) ; } } ] , function ( errIgnore ) { // ignore shutdown failure if ( errIgnore ) { retErr . shutdownError = errIgnore ; } cb0 ( retErr , result ) ; } ) ; } }
this is where the real resume/init happens
this is where the real resume / init happens