Set the pending status to a given error status. If the error does not have
code or details properties, the code will be set to grpc.status.UNKNOWN
and the details will be set to 'Unknown Error'.
@param {Error} err The error object
435878
function setStatus(err) {
    var code = constants.status.UNKNOWN;
    var details = 'Unknown Error';
    var metadata = new Metadata();
    if (err.hasOwnProperty('message')) {
      details = err.message;
    }
    if (err.hasOwnProperty('code')) {
      code = err.code;
      if (err.hasOwnProperty('details')) {
        details = err.details;
      }
    }
    if (err.hasOwnProperty('metadata')) {
      metadata = err.metadata;
    }
    stream.status = {code: code, details: details, metadata: metadata};
  }
213282
function (err) {
    var status = typeof err === 'number' ? err : err.status;

    if (!(err instanceof errors.HTTPError) && status) {
      return errors.create(status, err.message);
    }
    return err;
  }
440282
function(err, result) {
      if (err && !util.isError(err)) {
        err = new Error(err);
      }
      if (callback) callback(err, result);
    }
226825
def errorReceived(self, merr):
        
        d, timeout = self._pendingCalls.get(merr.reply_serial, (None, None))
        if timeout:
            timeout.cancel()
        if d:
            del self._pendingCalls[merr.reply_serial]
            e = error.RemoteError(merr.error_name)
            e.message = ''
            e.values = []
            if merr.body:
                if isinstance(merr.body[0], six.string_types):
                    e.message = merr.body[0]
                e.values = merr.body
            d.errback(e)
1174539
function onError(err) {
        if (callback) {
            callback(err);
        }
        else if (that.emitErrs) {
            that.emit('error', err);
        }
    }
292814
def error(self, reason=None):
        '''
        
        '''
        self.set_status(Report.ERROR)
        if reason:
            self.add('reason', reason)
560693
function DiscogsError(statusCode, message){
	Error.captureStackTrace(this, this.constructor);
	this.statusCode = statusCode||404;
	this.message = message||'Unknown error.';
}
13450
function sendError(res,err) {
    console.error(err);
    // also log last executed query, for easier debugging
    console.error(lastQry.sql);
    res.statusCode = 500;
    res.send({
        result: 'error',
        err:    err
    });
}
1229634
function(err) {
        if (err) this._onError(err);
        if (this._continueErrors || !err) {
            var args = [].slice.call(arguments);
            if (this._callbacks.length > 0) {
                this._isQueueRunning = true;
                var cb = this._callbacks.shift();
                cb = cb.bind(this);
                args = args.slice(1);
                args.push(this.next);
                cb.apply(this, args);

            } else {
                this._isQueueRunning = false;
                this.start = (function() {
                    this.start = null;
                    this.next.apply(this, args);
                }).bind(this);

            }
        }
        return this;
    }
208884
public function error($str, $code = Response::STATUS_ERROR)
    {
        $this->addError(new Error($str, $code));
        Container::get('response')->setStatus($code);
        if (!Container::get('response')->isStatus(Response::STATUS_OK)) {
            $this->serve();
        }
    }
1248544
function _onError (err) {
  if (err.status === 404 || err.statusCode === 404 || err.expose) return

  let msg = err.stack || err.toString()

  console.error(`\n${msg.replace(/^/gm, '   ')}\n`)
}
1010907
function serverError(err, res) {
  // error is required to be logged
  log('error', err.message, { stack: err.stack });

  const message = err.message || 'Server Error', // completely hide these messages from outside
    code = 500;

  sendDefaultResponseForCode(code, message, res);
}
981064
function(err) {
  // this set to the appropriate client via apply call in performConnect
  var client = this;
  if (typeof client === 'undefined'/* || client.constructor !== Client*/) {
    logger.entry('processQueuedActions', 'client was not set');
    logger.exit('processQueuedActions', 'client not set returning', null);
    return;
  }
  logger.entry('processQueuedActions', client.id);
  logger.log('parms', client.id, 'err:', err);
  logger.log('data', client.id, 'client.state:', client.state);

  if (!err) {
    var performSend = function() {
      logger.entry('performSend', client.id);
      logger.log('data', client.id, 'client._queuedSends',
                 client._queuedSends);
      while (client._queuedSends.length > 0 &&
              client.state === STATE_STARTED) {
        var remaining = client._queuedSends.length;
        var msg = client._queuedSends.shift();
        client.send(msg.topic, msg.data, msg.options, msg.callback);
        if (client._queuedSends.length >= remaining) {
          // Calling client.send can cause messages to be added back into
          // _queuedSends, if the network connection is broken.  Check that the
          // size of the array is decreasing to avoid looping forever...
          break;
        }
      }

      logger.exit('performSend', client.id, null);
    };

    var performUnsub = function() {
      logger.entry('performUnsub', client.id);

      if (client._queuedUnsubscribes.length > 0 &&
          client.state === STATE_STARTED) {
        var rm = client._queuedUnsubscribes.shift();
        logger.log('data', client.id, 'rm:', rm);
        if (rm.noop) {
          // no-op, so just trigger the callback without actually unsubscribing
          if (rm.callback) {
            logger.entry('performUnsub.callback', client.id);
            rm.callback.apply(client, [null, rm.topicPattern, rm.share]);
            logger.exit('performUnsub.callback', client.id, null);
          }
          setImmediate(function() {
            performUnsub.apply(client);
          });
        } else {
          client.unsubscribe(rm.topicPattern, rm.share, rm.options,
              function(err, topicPattern, share) {
                if (rm.callback) {
                  logger.entry('performUnsub.callback', client.id);
                  rm.callback.apply(client, [err, topicPattern, share]);
                  logger.exit('performUnsub.callback', client.id, null);
                }
                setImmediate(function() {
                  performUnsub.apply(client);
                });
              }
          );
        }
      } else {
        performSend.apply(client);
      }

      logger.exit('performUnsub', client.id, null);
    };

    var performSub = function() {
      logger.entry('performSub', client.id);

      if (client._queuedSubscriptions.length > 0 &&
          client.state === STATE_STARTED) {
        var sub = client._queuedSubscriptions.shift();
        logger.log('data', client.id, 'sub:', sub);
        if (sub.noop) {
          // no-op, so just trigger the callback without actually subscribing
          if (sub.callback) {
            process.nextTick(function() {
              logger.entry('performSub.callback', client.id);
              logger.log('parms', client.id, 'err:', err, ', topicPattern:',
                         sub.topicPattern, ', originalShareValue:', sub.share);
              sub.callback.apply(client,
                  [err, sub.topicPattern, sub.originalShareValue]);
              logger.exit('performSub.callback', client.id, null);
            });
          }
          setImmediate(function() {
            performSub.apply(client);
          });
        } else {
          client.subscribe(sub.topicPattern, sub.share, sub.options,
              function(err, topicPattern, share) {
                if (sub.callback) {
                  process.nextTick(function() {
                    logger.entry('performSub.callback',
                                 client.id);
                    logger.log('parms', client.id, 'err:', err,
                               ', topicPattern:', topicPattern,
                               ', share:', share);
                    sub.callback.apply(client,
                        [err, topicPattern, share]);
                    logger.exit('performSub.callback',
                                client.id, null);
                  });
                }
                setImmediate(function() {
                  performSub.apply(client);
                });
              }
          );
        }
      } else {
        performUnsub.apply(client);
      }

      logger.exit('performSub', client.id, null);
    };

    performSub();
  }
  logger.exit('processQueuedActions', client.id, null);
}
849411
function HttpError (code, error, description) {
    this.statusCode = code;

    if (error instanceof Error)
        WError.call(this, error, description || httpErrors[this.statusCode].description);
    else
        WError.call(this, error || httpErrors[this.statusCode].description);

    return this;
}
38873
function responseErrorBuilder(err, res) {
  if (res && res.body && _.isObject(res.body) && res.body.error) {
    // pass through error obj from API
    return res.body;
  } else {
    // build custom error
    return {
      error: {
        code: err.status || CL_CONSTANTS.RES_UNKNOWN,
        message: (res ? res.text : null) || err.toString(),
      }
    };
  }
}
1202531
function getErrorStatusCode (err) {
  // check err.status
  if (typeof err.status === 'number' && err.status >= 400 && err.status < 600) {
    return err.status
  }

  // check err.statusCode
  if (typeof err.statusCode === 'number' && err.statusCode >= 400 && err.statusCode < 600) {
    return err.statusCode
  }

  return undefined
}
678158
function onError (err) {
      if (!responded) {
        errState = true;
        responded = true;
        callback(err);

        //
        // Remove listeners to related events.
        //
        drone.removeListener('exit', onExit);
        drone.removeListener('message', onCarapacePort);
        clearTimeout(timeout);
      }
    }