Github user necouchman commented on a diff in the pull request:

    https://github.com/apache/guacamole-client/pull/252#discussion_r167134989
  
    --- Diff: 
guacamole-common/src/main/java/org/apache/guacamole/servlet/GuacamoleHTTPTunnelServlet.java
 ---
    @@ -149,26 +149,23 @@ protected void doPost(HttpServletRequest request, 
HttpServletResponse response)
          * @param response
          *     The HTTP response to use to send the error.
          *
    -     * @param guacStatus
    -     *     The status to send
    -     *
    -     * @param message
    -     *     A human-readable message that can be presented to the user.
    +     * @param guacamoleException
    +     *     The exception that caused this error.
          *
          * @throws ServletException
          *     If an error prevents sending of the error code.
          */
         protected void sendError(HttpServletResponse response,
    -            GuacamoleStatus guacStatus, String message)
    +            GuacamoleException guacamoleException)
                 throws ServletException {
     
             try {
     
                 // If response not committed, send error code and message
                 if (!response.isCommitted()) {
    -                response.addHeader("Guacamole-Status-Code", 
Integer.toString(guacStatus.getGuacamoleStatusCode()));
    -                response.addHeader("Guacamole-Error-Message", message);
    -                response.sendError(guacStatus.getHttpStatusCode());
    +                response.addHeader("Guacamole-Status-Code", 
Integer.toString(guacamoleException.getStatus().getGuacamoleStatusCode()));
    +                response.addHeader("Guacamole-Error-Message", 
guacamoleException.getMessage());
    --- End diff --
    
    Okay, I think I've reworked this in a way that avoids duplicating too much 
code but successfully hides internals we don't want to reveal.


---

Reply via email to