Send an Error to the client, and log it as an error in the log files.

@method sendError
195292
function(pMessage, pRequest, pResponse, fNext)
		{
			var tmpSessionID = null;
			if (pRequest.UserSession)
			{
				tmpSessionID = pRequest.UserSession.SessionID;
			}

			_Log.warn('API Error: '+pMessage, {SessionID: tmpSessionID, RequestID:pRequest.RequestUUID, RequestURL:pRequest.url, Action:'APIError'}, pRequest);
			pResponse.send({Error:pMessage});

			return fNext();
		}
176443
function (errors, throwsErrors) {
                if (errors.length === 0) {
                    return true;
                }
                if (!throwsErrors) {
                    for (var i = 0; i < errors.length; i++) {
                        this.$logError(errors[i].msgId, errors[i].msgArgs);
                    }
                } else {
                    var error, logs = aria.core.Log;
                    // aria.core.Log may not be available
                    if (logs) {
                        var messages = [];
                        for (var i = 0; i < errors.length; i++) {
                            errors[i].message = logs.prepareLoggedMessage(errors[i].msgId, errors[i].msgArgs);
                            messages.push(errors[i].message);
                        }
                        error = new Error(messages.join('\n'));
                    } else {
                        error = new Error();
                    }
                    error.errors = errors;
                    throw error;
                }
                return false;
            }
94739
public void sendError(int status, String message)
        throws IOException
    {
        // Find  error page.
        String error_page =
            _servletHttpRequest.getServletHandler().getErrorPage(status,_servletHttpRequest);

        resetBuffer();
        
        // Handle error page?
        if (error_page==null)
        {
            // handle normally
            _httpResponse.sendError(status,message);
        }
        else
        {   
            _httpResponse.setStatus(status,message);
            
            if (message == null)
            {
                message= (String)HttpResponse.__statusMsg.get(TypeUtil.newInteger(status));
                if (message == null)
                    message= "" + status;
            }

            // handle error page
            ServletHolder holder = _servletHttpRequest.getServletHolder();
            if (holder!=null)
                _servletHttpRequest.setAttribute(ServletHandler.__J_S_ERROR_SERVLET_NAME,
                                                 holder.getName());
            _servletHttpRequest.setAttribute(ServletHandler.__J_S_ERROR_REQUEST_URI,
                                             _servletHttpRequest.getRequestURI());
            _servletHttpRequest.setAttribute(ServletHandler.__J_S_ERROR_STATUS_CODE,
                                             new Integer(status));
            _servletHttpRequest.setAttribute(ServletHandler.__J_S_ERROR_MESSAGE,
                                             message);
            
            RequestDispatcher dispatcher=
                _servletHttpRequest.getServletHandler().getServletContext()
                .getRequestDispatcher(error_page);

            try
            {
                ((Dispatcher)dispatcher).error(_servletHttpRequest,this);
            }
            catch(ServletException e)
            {
                log.warn(LogSupport.EXCEPTION,e);
                _httpResponse.sendError(status,message); 
            }
        }
        complete();
    }
777275
function() {
      FS.readFile(path, options.encoding, function(err, text) {
        if (err) {
          // Forward the error
          return callback(err);
        }
        // Success
        callback(null, text.toString());
      });
    }
78444
public void sendError(int status) throws IOException {
        if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) {  //306998.15
            logger.logp(Level.FINE, CLASS_NAME,"sendError", "error --> "+ String.valueOf(status),"["+this+"]");
        }

        Object[] args = { new Integer(status) };
        sendError(status, MessageFormat.format(nls.getString("Error.reported.{0}", "Error reported: {0}"), args));
    }
58550
function send () {
      sent = true;
      // next tick it to avoid express catching runtime error in the callback
      //   getting caught by express and triggering app's error handler
      process.nextTick(function () {
        res.emit('finish');
        cb(null, res, body);
      });
    }
797732
function errors() {
        // handling 404 errors from config.express['404_redirect'] property
        if (config['404_redirect']) {
            server.use(function (req, res, next) {
                res.status(302)
                res.writeHead(302, { 'Location': config['404_redirect'] })
                res.end()
            })
        } else {
            server.use(function (req, res, next) {
                res.status(404).send({ message: 'not found' })
            })
        }

        if (errorHandlers.length) {
            for (let eh of errorHandlers) {
                server.use(wrapper(eh))
            }
        }

        //Default error handler
        server.use((err, req, res, next) => {
            if (!config.silent && !errorHandlers.length)
                app.drivers.logger.error('Unhandled server error', err)
            res.status(500)
               .json({
                   message: err.message,
                   stack: process.env.NODE_ENV === 'production' ? undefined : err.stack
               })
        })
    }
981098
function (err) {
        var message = {cmd: 'startupComplete', pid: process.pid};
        if (err) {
            console.warn(err.stack);
            message.error = err.message;
        }
        process.send(message);
    }
188546
function logHttpRequestError (uniqueId, err) {
    // require log client
    if (!logClient) {
        return
    }
    // log error
    logClient.log('httpRequestError', {
        httpRequestId: uniqueId.id,
        httpRequestErrorCreateTime: microTimestamp(),
        httpRequestError: err.message,
    })
}
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);
}
418851
function ClientError(message, status, cause) {
    ClientError.super_.call(this, message, status || StatusCode.CLIENT_ERROR, cause);
}
807764
function onError(err) {
    const ctx = err.client.$ctx;
    npm.events.error(ctx.options, err, {
        cn: npm.utils.getSafeConnection(ctx.cn),
        dc: ctx.dc
    });
}
958576
protected void sendError( String errText, HttpServletResponse response )
        throws IOException
    {
        sendError( errText, null, response );
    }
117490
function(err) {

        var message = 'Error occured while performing a JSON-WSP request. ' +
            err.message + '\n' +
            JSON.stringify({
                options : curOpts
            }, null, '  ').yellow;

        logger.error(message);
    }
1220949
function onErrorHandle($errno, $errstr, $errfile, $errline)
    {
        $error = array(
            'message' => $errstr,
            'file' => $errfile,
            'line' => $errline,
        );
        $this->errorResponse($error);
    }
1263217
function ErrorSave (message) {

  Error.call(this);

  // Add Information
  this.name    = 'ErrorSave';
  this.type    = 'server';
  this.status  = 500;
  if (message) {
    this.message = message;
  }

}
730851
function (message) {
      var err = new Error(("[riotx] " + message));
      settings$2.logger.output.apply(null, ['ERROR', err]);
      throw err;
    }