Send error messsage to the user
@param res
@param err
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
    });
}
432672
function(packet, err) {
        var crash = true;

        this.emitEvent('packetError', packet, err, function() {
            crash = false;
        });

        if(crash) {
            if(this.debug >= 1)
                this.log('Packet error detected! Check packetError event in README.md');
            throw err;
        }
    }
1302042
function receiverOnError(err) {
  const websocket = this[kWebSocket];

  websocket._socket.removeListener('data', socketOnData);

  websocket.readyState = WebSocket.CLOSING;
  websocket._closeCode = err[kStatusCode];
  websocket.emit('error', err);
  websocket._socket.destroy();
}
1174539
function onError(err) {
        if (callback) {
            callback(err);
        }
        else if (that.emitErrs) {
            that.emit('error', err);
        }
    }
1288116
function throwError(res, errorCode) {
    const error = decodeError(errorCode);
    res.writeHead(error.status, { 'Content-Type': 'application/json' });
    res.write(JSON.stringify(error));
    res.end();
}
930483
function onRequestError(error, result, endCallback) {
      result.currentRetries++;
      async.parallel([
        async.apply(recrawlError, error, result),
        async.apply(retrySameUrl,error, result)
      ],function(error){
          endCallback(error);
      });

  }
924120
function handleError(res) {
  return function (err) {
    if (err.status && err.name !== 'NotFoundError') {
      // If we're in this block, the error has a defined `status` property and
      // the error should be directed out immediately
      sendDefaultResponseForCode(err.status, err.message, res);
    } else if (err.name === 'NotFoundError' ||
      err.message.indexOf('ENOENT') !== -1 ||
      err.message.indexOf('not found') !== -1) {
      notFound(err, res);
      // if the word "client" is ever in a message, it should be for the client.  We enforce that here.
    } else if (err.message.indexOf('Client') !== -1) {
      clientError(err, res);
    } else {
      serverError(err, res);
    }
  };
}
686640
public static void error(String msg, Throwable t) {
        if (quietMode)
            return;

        System.err.println(ERR_PREFIX + msg);
        if (t != null) {
            t.printStackTrace();
        }
    }
206333
function err(...messages) {
  console.error(...messages);
  const p = document.createElement('p');
  p.innerText = messages.join(' ');
  p.style = 'color: red';
  logElement.appendChild(p);
}
105510
function handleErr_(errback, json) {
  if (errback && json && json.error) {
    errback(json.error);
  }
}
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);
}
1001926
function(err) {
    var validationErrMsg = self.handleError(err)
    if (!validationErrMsg) return false
    else { 
      self._merge(validationErrors, validationErrMsg, prefix)
      isValid = false
      return true
    }
  }
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(),
      }
    };
  }
}
995671
function HyperError(res) {
  Error.call(this);
  Error.captureStackTrace(this, arguments.callee);
  this.name = 'HyperError';
  this.status = res.status;
  if (res.body && res.body.error) this.message = res.body.error.message;
  else this.message = res.text;
}
734500
function formatResponseError(resp) {
    let result;

    if (resp.data.error) {
        result = resp.data.error.detail || resp.data.error;
    }
    else {
        result = resp.data.detail || JSON.stringify(resp.data);
    }

    return result.replace(/\n/g, '');
}
221991
function error(socket, err) {
  socket.emit(SECRET + ':error', {
    message: err.message,
    stack: cleanedStack(err.stack)
  });
}
371171
function throwTimeoutError(resp) {
  let err = new Error('timeout');
  err.type = 'timeout';
  err.response = resp;
  err.url = resp.url;
  throw err;
}