void sendError(HttpResponseStatus status, Throwable ex) {
    String msg;

    if (ex instanceof InvocationTargetException) {
      msg = String.format("Exception Encountered while processing request : %s", ex.getCause().getMessage());
    } else {
      msg = String.format("Exception Encountered while processing request: %s", ex.getMessage());
    }

    // Send the status and message, followed by closing of the connection.
    responder.sendString(status, msg, new DefaultHttpHeaders().set(HttpHeaderNames.CONNECTION, HttpHeaderValues.CLOSE));
    if (bodyConsumer != null) {
      bodyConsumerError(ex);
    }
  }
void sendError ( HttpResponseStatus status , Throwable ex ) { String msg ; if ( ex instanceof InvocationTargetException ) { msg = String . format ( "Exception Encountered while processing request : %s" , ex . getCause ( ) . getMessage ( ) ) ; } else { msg = String . format ( "Exception Encountered while processing request: %s" , ex . getMessage ( ) ) ; } responder . sendString ( status , msg , new DefaultHttpHeaders ( ) . set ( HttpHeaderNames . CONNECTION , HttpHeaderValues . CLOSE ) ) ; if ( bodyConsumer != null ) { bodyConsumerError ( ex ) ; } }
Sends the error to responder.