@param {Error} err

@param {IncomingMessage} req
@param {Function} req.get

@param {string} env

@returns {Object|string}
341095
function getResponseMessage( err, req, env ) {
  var content_type = req.get( 'content-type' ) || ''
  var message = err.toString()

  if ( content_type.indexOf( 'application/json' ) !== -1 ) {
    message = {
      error: {
        code: err.code || null,
        errorCode: err.errorCode || null,
        message: err.toString(),
        status: err.status || null,
        statusCode: err.statusCode || 500
      }
    }
  } else if ( env === 'development' ) {
    message = '<pre>' + err.stack
  }

  return message
}
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;
    }
578441
function (err, body) {
          if (!err) {
            var val = body.GET
            if (val) {
              /*
              {
                "GET": "[resource]@[id]"
              }
              */
              val = val.split('@')
              // overwrite body
              body = {
                'resource': val[0],
                '_id': val[1]
              }

              // success, pass the object
              callback(null, body)
            } else {
              // Redis key not found
              body = {
                'status': 404,
                'error_code': -44,
                'message': 'Page not found, invalid slug or store ID'
              }
              var msg = body.message
              errorHandling(callback, msg, body)
            }
          } else {
            // just pass the error
            callback(err, body)
          }
        }
498421
function error(err) {
    if (!(err instanceof Error)) return err
    return {
        code: err.code,
        message: err.message,
        details: err.detail,
        stack: err.stack || ''
    }
}
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;
  }
917975
function decoded(err, reply) {
  //console.error('got decoder err %s', err );
  //console.error('got decoder reply %j',reply );
  var res = new Response(this), req, cmd, args;
  if(err) {
    // return decoder errors to the client
    return res.send(err);
  }

  // we should only be handling array request types
  if(!Array.isArray(reply)) {
    return res.send(new Error('bad request, array expected'));
  }else if(!reply.length) {
    return res.send(new Error('bad request, empty array invalid'));
  }

  cmd = reply.shift();

  if(cmd instanceof Buffer) cmd = cmd.toString();

  if(typeof cmd !== 'string') {
    return res.send(new Error('bad request, string command expected'));
  }

  cmd = cmd.toLowerCase();

  // keep track of last command
  this._client.cmd = cmd;

  //console.error('got decoder cmd %s', cmd );
  //console.error('got decoder args %j', reply );

  req = new Request(this, cmd, reply);

  this.emit('command', req, res);
}
1193883
function getErrorSource (err) {
  let result

  try {
    const { fileName, lineNumber, columnNumber } = errorStackParser.parse(err).shift()
    result = `${fileName}:${lineNumber}:${columnNumber}`
  } catch (err) {}

  return result
}
672601
function destructureClientError (error) {
  const { method, url } = error.config
  const { status, data } = error.response
  const reason = R.has('reason', data) ? data.reason : R.toString(data)

  return `${method.toUpperCase()} to ${url} failed with ${status}: ${reason}`
}
1189428
def call!(env)
      status, headers, body = @app.call(env)
      if error = env['deas.error']
        error_body = Body.new(error)

        headers['Content-Length'] = error_body.size.to_s
        headers['Content-Type']   = error_body.mime_type.to_s
        body = [error_body.content]
      end
      [status, headers, body]
    end
630391
function errorHandler(err, req, res, next){
  if (!req.suppressErrorHandlerConsole && !req.app.suppressErrorHandlerConsole) {
    if (req.log) {
      req.log.error(err, "Unhandled Error");
    } else {
      console.log("Unhandled error");
      console.log(err.stack || err);
    }
  }
  if (err.status) res.statusCode = err.status;
  if (res.statusCode < 400) res.statusCode = 500;
  if (res._header) return; //??
  var accept = req.headers.accept || '';
  var stack = req.app.get('env') != 'production' ? err.stack : '';
  // html
  if (~accept.indexOf('html')) {
    res.render('error.html', {
      message: http.STATUS_CODES[res.statusCode],
      statusCode: res.statusCode,
      error: err.toString(),
      errorstack: (stack || '').split('\n').slice(1)
    });
  // json
  } else if (~accept.indexOf('json')) {
    var error = { message: err.message, stack: stack };
    for (var prop in err) error[prop] = err[prop];
    res.json({ error: error });
  // plain text
  } else {
    res.setHeader('Content-Type', 'text/plain');
    res.end(stack);
  }
}
1078035
function convertApiError(err) {
	if (err.error && err.error.response && err.error.response.text) {
		const obj = JSON.parse(err.error.response.text);
		if (obj.errors && obj.errors.length) {
			err = { message: obj.errors[0].message, error:err.error };
		}
	}
	return err;
}
1308286
function(err) {
    if (
        process.argv[2] == '-s' && startWithGina
            || process.argv[2] == '--start' && startWithGina
            //Avoid -h, -v  ....
            || !startWithGina && isPath && process.argv.length > 3

        ) {
        if (isPath && !startWithGina) {
            console.log('You are trying to load gina by hand: just make sure that your env ['+env+'] matches the given path ['+ path +']');
        } else if ( typeof(err.stack) != 'undefined' ) {
            console.log('Gina could not determine which bundle to load: ' + err +' ['+env+']' + '\n' + err.stack);
        } else {
            console.log('Gina could not determine which bundle to load: ' + err +' ['+env+']');
        }
        process.exit(1);
    }
}
356375
def call(env)
      # Store environment, request and response for later
      req = ::Rack::Request.new(env)
      res = ::Rack::Response.new

      logger.debug "== Request: #{env['PATH_INFO']}"

      # Catch :halt exceptions and use that response if given
      catch(:halt) do
        process_request(env, req, res)
        res.status = 404
        res.finish
      end
    end
1169982
function defaultErrorHandler(err, req, res) {
  if (err.name === 'UnauthorizedError') { // authentication is expected to be a common use-case
    res.status(401).end();
  } else {
    if (!err.status || err.status >= 500) {
      console.error(err.stack || err.toString());
    }
    res.status(err.status || 500).json({message: err.message})
  }
}
1251265
function getErrorMessage (err, target, defaultMsg) {
    var errMessage;
    if (err) {
        errMessage = err.toString();
    } else {
        errMessage = defaultMsg;
    }
    return errMessage.replace('%target%', target);
}
815056
function error(status, msg) {
  var err = new Error(msg);
  err.status = status;
  return err;
}
608999
function onError(e) {
    if (!inBrowser) {
        return {};
    }

    let response = {};
    if (e.response) {
        response = e.response.data;
    }

    throw Object.assign({
        statusCode: 500,
        message: 'Request error'
    }, response);
}