Queue a command.

The command and arguments list should already have been
validated to determine if an error would occur (EXECABORT).

@param err A validation error.
@param req The command request.
@param res The command response.
186482
function add(err, req, res) {
  if(err) {
    // TODO: send args length errors

    // transaction errors are not queued
    // but the transaction is left open for more
    // command to be queued
    if(err instanceof TransactionError) {
      return res.send(err);
    }
    // last error
    this.error = err;
  }

  this.queue.push({err: err, req: req, res: res});
  res.send(null, QUEUED);
}
1301255
function errorHandler (err) {
  let errorMessage = process.env.DEBUG ? err.stack : err.message;
  console.error(chalk.red(errorMessage));
  process.exit(1);
}
114280
async def immediate_execute_command(self, *args, **options):
        
        command_name = args[0]
        conn = self.connection
        # if this is the first call, we need a connection
        if not conn:
            conn = self.connection_pool.get_connection()
            self.connection = conn
        try:
            await conn.send_command(*args)
            return await self.parse_response(conn, command_name, **options)
        except (ConnectionError, TimeoutError) as e:
            conn.disconnect()
            if not conn.retry_on_timeout and isinstance(e, TimeoutError):
                raise
            # if we're not already watching, we can safely retry the command
            try:
                if not self.watching:
                    await conn.send_command(*args)
                    return await self.parse_response(conn, command_name, **options)
            except ConnectionError:
                # the retry failed so cleanup.
                conn.disconnect()
                await self.reset()
                raise
40904
function(id, msg) {
        var q = queues[id];
        // execute failure callback
        if (q.onFailure) {
            var sc=q.scope || q.win;
            q.onFailure.call(sc, _returnData(q, msg));
        }
    }
897124
function (cmd, err) {
    if (!cmd || !_.isObject(cmd)) {
      var err = new Error('Please pass a valid command!');
      debug(err);
      throw err;
    }
    if (!err || !_.isObject(err)) {
      var err = new Error('Please pass a valid error!');
      debug(err);
      throw err;
    }

    var evt = {};

    if (!!this.definitions.command.meta && !!this.definitions.event.meta) {
      dotty.put(evt, this.definitions.event.meta, dotty.get(cmd, this.definitions.command.meta));
    }

    dotty.put(evt, this.definitions.event.correlationId, dotty.get(cmd, this.definitions.command.id));
    dotty.put(evt, this.definitions.event.name, this.options.commandRejectedEventName);
    dotty.put(evt, this.definitions.event.id, dotty.get(cmd, this.definitions.command.id) + '_rejected');
    dotty.put(evt, this.definitions.event.aggregateId, dotty.get(cmd, this.definitions.command.aggregateId));

    if (!!this.definitions.command.aggregate && !!this.definitions.event.aggregate) {
      dotty.put(evt, this.definitions.event.aggregate, dotty.get(cmd, this.definitions.command.aggregate));
    }

    if (!!this.definitions.command.context && !!this.definitions.event.context) {
      dotty.put(evt, this.definitions.event.context, dotty.get(cmd, this.definitions.command.context));
    }

    if (err instanceof ValidationError || err instanceof BusinessRuleError ||
        err instanceof AggregateDestroyedError || err instanceof AggregateConcurrencyError ||
        err instanceof DuplicateCommandError) {
      dotty.put(evt, this.definitions.event.payload, {
        command: cmd,
        reason: {
          name: err.name,
          message: err.message,
          more: err.more
        }
      });

      if (!!this.definitions.event.revision && dotty.get(evt, this.definitions.event.revision) === undefined && err.more && err.more.aggregateRevision > -1) {
        dotty.put(evt, this.definitions.event.revision, err.more.aggregateRevision);
      }
    } else {
      evt = null;
    }

    return evt;
  }
14149
private void processCommand(List<String> command) throws Exception {
        processBuilder.command(command);
        Process p = processBuilder.start();
        checkReturnCode(p, processBuilder.command().toString(), 0);
    }
841604
function (err) {
        if (err) {
          reject(err);
        } else if (arguments.length === 2) { // single param?
          resolve(arguments[1]);
        } else { // multiple params?
          var cbArgsArray = self.toArgsArray(arguments);
          resolve(cbArgsArray.slice(1)); // remove err arg
        }
      }
1124770
function reqres(res, req) {
    if (req && req._headers) {
        throw new Error('Received response object where request object was expected');
    }
    this.res = res;
    this.req = req;
    if (res) {
        if (res.$ && res.$.data) {
            this.data = res.$.data;
        }
        else {
            this.data = { error: null };
            if (!res.$) {
                res.$ = this;
            }
        }
    }
}
752540
function responseHandler(err, res) {
            //console.log('resp', err, res.status);
            // Handle connection HTTPS errors.
            if (err){
                d.reject(err);
            }else {
                var answer = {
                    code: res.status,
                    headers: res.headers,
                    data: res.body
                };

                // Check if response is IDOL API error or not
                if (res.status < 200 || res.status >= 300) {
                    // YES it is error.
                    // Resolve the promise with the error.
                    d.reject(answer);
                } else {
                    // NO it is not error.
                    // Queue the job for polling if it is async job.
                    if (options.type == 'async' && Boolean(self.options.autoResult)) {
                        self
                            .jobResult(res.body.jobID)
                            .done(
                                _.partial(self.emit, 'job result'),
                                _.partial(self.emit, 'job result error')
                        );
                    }
                    // Resolve the promise with the result.
                    d.resolve(answer);
                }
            }
        }
1198975
function Request(args) {
  if (false === (this instanceof Request)) throw new Error('new operator required');
  if (typeof args == 'string') {
    var quickType = args;
    args = {};
    args.type = quickType;
  }
  args = args || {};
  this.type = args.type || null;
  if (args.value) // todo spec as optional param
    this.value = args.value;
  if (!this.type || typeof this.type != 'string') throw new Error('Request type required');
  switch (this.type) {
    case 'Command':
      this.command = args.command || null;
      if (!(this.command instanceof Command)) throw new Error('command object required');
      break;
  }
}
191140
function delegate(req, res) {
  var cmd = req.info.command
    , method;

  if(!cmd.sub) {
    throw new Error('attempt to delegate with no subcommand info');
  }

  method = req.exec[cmd.sub.cmd];

  // subcommand is declared but the command exec handler
  // has not declared the method and is attempting to delegate
  // we treat this as unknown subcommand which allows partial
  // subcommand exec handlers that may call delegate but only
  // implement a subset of the declared subcommands
  if(typeof method !== 'function') {
    return res.send(StoreError.UnknownSubcommand);
  }

  // rewrite the cmd/args
  req.cmd = cmd.sub.cmd;
  req.args = cmd.sub.args;
  method.call(this, req, res);
}
28723
function execute(req, res) {
  req.conn.monitor(this);
  res.send(null, Constants.OK);
}
1162999
function(command, callback) {
    var self = this;
    return new Promise(function(resolve, reject) {
        var prCB = function(err, data) {
          if (err) {
            log.error(err.message);
            log.debug(command);
          }
          return (err ? reject('err') : resolve(data));
        };
        self.connection.execute(command, function(err, result) {
          prCB(err, result)
        });
    });
  }
1053855
function CommandError (err) {
  this.name = 'CommandError'
  this.command = err.command
  this.message = err.message
  this.stack = err.stack
  this.buffer = err.buffer
  this.status = err.status
  Error.captureStackTrace(this, CommandError)
}
452262
function fail(err, status=1) {
    console.log(process.env.DEBUG ? err.stack : err.message);
    process.exit(status);
}
406413
def issueCommand(self, command, *args):
        
        result = Deferred()
        self._dq.append(result)
        self.sendLine(b" ".join([command] + list(args)))
        return result
1091622
function execute(req, res) {
  // store returns a number but we need to send
  // a bulk string reply
  var reply = req.exec.proxy(req, res);
  res.send(null, '' + reply);
}