Send an error message.

@param type         the error type
@param errString    the error string
@param exchange     the http server exchange
558815
static void processError(String type, String errString, HttpServerExchange exchange) {
        exchange.setStatusCode(StatusCodes.INTERNAL_SERVER_ERROR);
        exchange.getResponseHeaders().add(Headers.CONTENT_TYPE, CONTENT_TYPE);
        exchange.getResponseHeaders().add(new HttpString("Version"), VERSION_PROTOCOL);
        exchange.getResponseHeaders().add(new HttpString("Type"), type);
        exchange.getResponseHeaders().add(new HttpString("Mess"), errString);
        exchange.endExchange();
        UndertowLogger.ROOT_LOGGER.mcmpProcessingError(type, errString);
    }
151037
@Override
    public void handleRequest(final HttpServerExchange exchange) throws Exception {
        if(exchange.isInIoThread()) {
            exchange.dispatch(this);
            return;
        }
        SecurityContext context = exchange.getSecurityContext();
        if (context.authenticate()) {
            if(!exchange.isComplete()) {
               next.handleRequest(exchange);
            }
        } else {
            exchange.endExchange();
        }
    }
282826
public void error(MEConnection conn, Throwable ex)
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.entry(tc, "error", new Object[] { this, conn, ex});

    // This one goes straight to the CEL
    _commsErrorListener.error(conn, ex);

    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.exit(tc, "error");
  }
590497
static function handleError($errstr, $type = E_USER_ERROR)
    {
        self::set("errors", true);

        trigger_error($errstr, $type);
    }
811748
function createExchangeErrorHandlerFor (exchange) {
  return function (err) {
    if (!exchange.options.confirm) return;

    // should requeue instead?
    // https://www.rabbitmq.com/reliability.html#producer
    debug && debug('Exchange error handler triggered, erroring and wiping all unacked publishes');
    for (var id in exchange._unAcked) {
      var task = exchange._unAcked[id];
      task.emit('ack error', err);
      delete exchange._unAcked[id];
    }
  };
}
531365
public void error(CharSequence message, Throwable e) {
    log(Level.SEVERE, message, e);
  }
883535
public function errorHandler(int $type, string $message, string $file, int $line) :void
    {
        $this->whichError($message, $type, $file, $line);
    }
318677
public static void sendError(int errorCode, String errorContent) {
		HttpServletResponse response = Response.getServletResponse();
		try {
			if(HuluSetting.isDevMode) {
				response.sendError(errorCode);
			}else {
				response.sendError(errorCode, errorContent);
			}
		} catch (IOException e) {
			log.error(e, "Error when sendError!");
		}
	}
967487
protected void addError(String errorKey, String errorMessage) {
		invalid = true;
		controller.setAttr(errorKey, errorMessage);
		if (shortCircuit) {
			throw new ValidateException();
		}
	}
598903
static void sendResponse(final HttpServerExchange exchange, final String response) {
        exchange.setStatusCode(StatusCodes.OK);
        exchange.getResponseHeaders().add(Headers.CONTENT_TYPE, CONTENT_TYPE);
        final Sender sender = exchange.getResponseSender();
        UndertowLogger.ROOT_LOGGER.mcmpSendingResponse(exchange.getSourceAddress(), exchange.getStatusCode(), exchange.getResponseHeaders(), response);
        sender.send(response);
    }
591356
public static StoreException create(final Type type, final Throwable cause, final String errorMessage) {
        Preconditions.checkArgument(cause != null || (errorMessage != null && !errorMessage.isEmpty()),
                "Either cause or errorMessage should be non-empty");
        StoreException exception;
        switch (type) {
            case DATA_EXISTS:
                exception = new DataExistsException(errorMessage, cause);
                break;
            case DATA_NOT_FOUND:
                exception = new DataNotFoundException(errorMessage, cause);
                break;
            case DATA_CONTAINS_ELEMENTS:
                exception = new DataNotEmptyException(errorMessage, cause);
                break;
            case WRITE_CONFLICT:
                exception = new WriteConflictException(errorMessage, cause);
                break;
            case ILLEGAL_STATE:
                exception = new IllegalStateException(errorMessage, cause);
                break;
            case OPERATION_NOT_ALLOWED:
                exception = new OperationNotAllowedException(errorMessage, cause);
                break;
            case CONNECTION_ERROR:
                exception = new StoreConnectionException(errorMessage, cause);
                break;
            case UNKNOWN:
                exception = new UnknownException(errorMessage, cause);
                break;
            default:
                throw new IllegalArgumentException("Invalid exception type");
        }
        return exception;
    }
375570
public void error(final IJNRPEExecutionContext ctx, final String message) {
        postEvent(ctx, new LogEvent(source, LogEventType.ERROR, message));
    }
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();
    }
792909
public synchronized void transferError(Exception e) {
	logger.debug("intercepted exception", e);
	if (transferException == null) {
	    transferException = e;
	} else if (transferException instanceof InterruptedException
		   || transferException instanceof InterruptedIOException) {
	    //if one of the threads throws an error, it interrupts
	    //the other thread (by InterruptedException).
	    //Here we make sure that transferException will store the
	    //primary failure reason, not the resulting InterruptedException
	    transferException = e;
	}
	notifyAll();
    }
834205
function sendError(msg, file, line, col, err) {
        var errString = 'JSON not found';
        if (window.JSON) {
            errString = JSON.stringify(err);
        }

        if (typeof(msg) === 'object') {
            file      = msg.filename;
            line      = msg.lineno;
            col       = msg.colno;
            errString = msg.error.stack;
            msg       = msg.message;
        }

        new Image().src = pathServerAPI + 'jserrors?msg=' + encodeURIComponent(msg) + '&file=' + encodeURIComponent(file) + '&line=' + encodeURIComponent(line) + '&col=' + encodeURIComponent(col) + '&err=' + encodeURIComponent(errString);
    }
1027279
static void processOK(HttpServerExchange exchange) throws IOException {
        exchange.setStatusCode(StatusCodes.OK);
        exchange.getResponseHeaders().add(Headers.CONTENT_TYPE, CONTENT_TYPE);
        exchange.endExchange();
    }
502548
private void sendNSFailed(IConnection conn, String errorCode, String description, String name, Number streamId) {
        StreamService.sendNetStreamStatus(conn, errorCode, description, name, Status.ERROR, streamId);
    }