Chain and execute given steps immediately. The last step in chain
will be the error- and result-handling callback.
541218
function chainAndCall(chainer) {
    return function(/*step1, step2, ...*/) {
        var steps = slice.call(arguments);
	    var callback = steps.pop();
	    chainer.apply(null, steps)(callback);
    };
}
811885
function step(inst, raw, argv, event, fin) {
    if (!_isPresent(raw)) return fin(_wrapError(_badInput(inst), inst, raw), null);
    var flat = _denestList(raw);
    preproc(inst, flat, argv, event, function postPreproc(err, data) {
        if (err) return fin(err);
        var list = _safeObject(data);
        return branch(inst, list, argv, event, fin);
    });
}
1267523
def _step_failure(self, exc):
        
        self.log_crit(u"STEP %d (%s) FAILURE" % (self.step_index, self.step_label))
        self.step_index += 1
        self.log_exc(u"Unexpected error while executing task", exc, True, ExecuteTaskExecutionError)
440282
function(err, result) {
      if (err && !util.isError(err)) {
        err = new Error(err);
      }
      if (callback) callback(err, result);
    }
1282564
def execute(self):
        
        stack = self._stack
        callbacks = self._callbacks
        self._stack = []
        self._callbacks = []

        deferred = []

        build = self._nested_future

        pipe = self._pipeline(self.connection_name)
        for item, args, kwargs, ref in stack:
            f = getattr(pipe, item)
            deferred.append(build(f(*args, **kwargs), ref))

        inject_callbacks = getattr(self.parent, '_inject_callbacks')
        inject_callbacks(deferred + callbacks)
285896
function next(err) {
            var middleware = stack[index++];

            // No more middlewares or early end.
            if (!middleware || ended) {
                if (out) out(err, ctx);
                return;
            }

            // Check if middleware type matches or if it has no type.
            if (middleware.type.indexOf(type) === -1 && middleware.type.length > 0) {
                return next(err);
            }

            try {
                var arity = middleware.cb.length;
                //if err, only execute error middlewares
                if (err) {
                    //error middlewares have an arity of 3, the first
                    //arg being the error
                    if (arity === 3) {
                        middleware.cb(err, ctx, next);
                    } else {
                        next(err);
                    }
                } else if (arity < 2) {
                    middleware.cb(ctx);
                    next();
                } else if (arity < 3) {
                    middleware.cb(ctx, next);
                } else {
                    next();
                }
            }
            catch (e) {
                next(e);
            }
        }
221010
function after(results, next) {
    item.trigger('after:' + method, function done(error) {
      next(error, results);
    });
  }
149851
function done( error, results, info ) {
			error = error || null;
			results = results || null;
			info = info || null;
			clbk( error, results, info );
		}
502164
public function ExecuteStep()
    {
        if ($this->ProcessStep()) {
            $this->ProcessStepSuccessHook();
            $oBasket = TShopBasket::GetInstance();
            $oBasket->aCompletedOrderStepList[$this->fieldSystemname] = true;
            $oNextStep = $this->GetNextStep();
            $this->JumpToStep($oNextStep);
        }
    }
430906
function (cb) {
            if (cb) {
                if (isPromise(cb)) {
                    cb = cb.errback;
                }
                if (this.__fired && this.__error) {
                    this.__callNextTick(cb, this.__error);
                } else {
                    this.__errorCbs.push(cb);
                }
            }
            return this;
        }
19450
def execute(self, raise_on_error=True):
        ""
        stack = self.command_stack
        if not stack:
            return []
        execute = self._execute_pipeline

        conn = self.connection
        if not conn:
            conn = self.connection_pool.get_connection('batch')
            # assign to self.connection so reset() releases the connection
            # back to the pool after we're done
            self.connection = conn

        try:
            return execute(conn, stack, raise_on_error)
        except ConnectionError:
            conn.disconnect()
            return execute(conn, stack, raise_on_error)
        finally:
            self.reset()
458402
def execute_after_feature_steps(self, context):
        
        if not self.feature_error:
            self.__execute_steps_by_action(context, ACTIONS_AFTER_FEATURE)

        # Behave dynamic environment: Fail all steps if dyn_env has got any error and reset it
        if self.reset_error_status():
            context.feature.reset()
            for scenario in context.feature.walk_scenarios():
                context.dyn_env.fail_first_step_precondition_exception(scenario)
1192319
public void handleTransaction(ChaincodeMessage message) {
		// The defer followed by triggering a go routine dance is needed to ensure that the previous state transition
		// is completed before the next one is triggered. The previous state transition is deemed complete only when
		// the beforeInit function is exited. Interesting bug fix!!
		Runnable task = () -> {
			//better not be nil
			ChaincodeMessage nextStatemessage = null;
			boolean send = true;

			//Defer
			try {
				// Get the function and args from Payload
				ChaincodeInput input;
				try {
					input = ChaincodeInput.parseFrom(message.getPayload());
				} catch (Exception e) {
					logger.debug(String.format("[%s]Incorrect payload format. Sending %s", shortID(message), ERROR));
					// Send ERROR message to chaincode support and change state
					nextStatemessage = ChaincodeMessage.newBuilder()
							.setType(ERROR)
							.setPayload(message.getPayload())
							.setTxid(message.getTxid())
							.build();
					return;
				}

				// Mark as a transaction (allow put/del state)
				markIsTransaction(message.getTxid(), true);

				// Create the ChaincodeStub which the chaincode can use to callback
				ChaincodeStub stub = new ChaincodeStub(message.getTxid(), this, message.getSecurityContext());

				// Call chaincode's Run
				ByteString response;
				try {
					response = chaincode.runHelper(stub, getFunction(input.getArgsList()), getParameters(input.getArgsList()));
				} catch (Exception e) {
					e.printStackTrace();
					System.err.flush();
					// Send ERROR message to chaincode support and change state
					logger.error(String.format("[%s]Error running chaincode. Transaction execution failed. Sending %s",
							shortID(message), ERROR));
					nextStatemessage = ChaincodeMessage.newBuilder()
							.setType(ERROR)
							.setPayload(message.getPayload())
							.setTxid(message.getTxid())
							.build();
					return;
				} finally {
					deleteIsTransaction(message.getTxid());
				}

				logger.debug(String.format("[%s]Transaction completed. Sending %s",
						shortID(message), COMPLETED));

				// Send COMPLETED message to chaincode support and change state
				Builder builder = ChaincodeMessage.newBuilder()
						.setType(COMPLETED)
						.setTxid(message.getTxid());
				if (response != null) builder.setPayload(response);
				nextStatemessage = builder.build();
			} finally {
				triggerNextState(nextStatemessage, send);
			}
		};

		new Thread(task).start();
	}
1176015
function finish(err) {
      // Run callbacks when we have an error,
      // or when import parsing is complete.
      if (err || self.isParsed()) {
        // Cache the file after parsing:
        _.cacheFile(self);

        // Run all callbacks:
        for (var i=0; i < self._cb.length; i++) self._cb[i](err, self);
        self._cb = [];
      }
    }
1017791
def execute(event)
      old_chain = @chain
      @bot.debug 'Executing bare chain'
      result = execute_bare(event)

      @chain_args ||= []

      @bot.debug "Found chain args #{@chain_args}, preliminary result #{result}"

      @chain_args.each do |arg|
        case arg.first
        when 'repeat'
          new_result = ''
          executed_chain = divide_chain(old_chain).last

          arg[1].to_i.times do
            chain_result = CommandChain.new(executed_chain, @bot).execute(event)
            new_result += chain_result if chain_result
          end

          result = new_result
          # TODO: more chain arguments
        end
      end

      result
    end
1277886
function(deferred, description) {

      // The results from the previous steps are given as additional arguments to this method.
      // If the result is a single `StepArgs` object (such as returned by `#success`),
      // the multiple results it contains are spread over the arguments of the next step's function.
      // This is what allows a step to pass multiple results to the next step even though
      // a promise can only be resolved with one value.
      var results = slice.call(arguments, 2);
      if (results.length == 1 && results[0] instanceof StepArgs) {
        results = results[0].args;
      }

      if (this.stepSkipped) {
        // **EVENT:** the `step:skip` event is emitted if the step was skipped.
        // The first argument is the step description object, the second argument
        // is the skip message, and remaining arguments are the results that will be
        // passed to the next step.
        this.emit.apply(this, [ 'step:skip', description, this.skipMessage ].concat(results));
      } else {
        // **EVENT:** the `step:done` event is emitted otherwise.
        // The first argument is the step description object, and remaining arguments
        // are the results that will be passed to the next step.
        this.emit.apply(this, [ 'step:done', description ].concat(results));
      }

      var nextStep = this.getNextStep();

      // The scenario is stopped if there are no more steps to run or if it was marked as completed.
      if (!nextStep || this.completed) {

        // **EVENT:** the `scenario:end` event is emitted when the scenario has finished running.
        this.emit('scenario:end');

        return deferred.resolve();
      }

      // The next step is run with the results from the previous step as arguments.
      this.runStep.apply(this, [ nextStep, deferred ].concat(results));
    }
389090
def errback(self, result):
        

        assert(isinstance(result, BaseException))
        self._start_callbacks(result, True)