GUACAMOLE-566: Minor style cleanups; use APIError for unhandled exceptions.

Project: http://git-wip-us.apache.org/repos/asf/guacamole-client/repo
Commit: http://git-wip-us.apache.org/repos/asf/guacamole-client/commit/6cb50bd4
Tree: http://git-wip-us.apache.org/repos/asf/guacamole-client/tree/6cb50bd4
Diff: http://git-wip-us.apache.org/repos/asf/guacamole-client/diff/6cb50bd4

Branch: refs/heads/master
Commit: 6cb50bd4f8ea47ec1f2fb6ff79c6aceeb83c84e0
Parents: 383a717
Author: Nick Couchman <[email protected]>
Authored: Wed May 30 06:27:21 2018 -0400
Committer: Nick Couchman <[email protected]>
Committed: Wed May 30 06:27:21 2018 -0400

----------------------------------------------------------------------
 .../java/org/apache/guacamole/rest/RESTExceptionMapper.java     | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/guacamole-client/blob/6cb50bd4/guacamole/src/main/java/org/apache/guacamole/rest/RESTExceptionMapper.java
----------------------------------------------------------------------
diff --git 
a/guacamole/src/main/java/org/apache/guacamole/rest/RESTExceptionMapper.java 
b/guacamole/src/main/java/org/apache/guacamole/rest/RESTExceptionMapper.java
index ae35274..931408d 100644
--- a/guacamole/src/main/java/org/apache/guacamole/rest/RESTExceptionMapper.java
+++ b/guacamole/src/main/java/org/apache/guacamole/rest/RESTExceptionMapper.java
@@ -92,7 +92,7 @@ public class RESTExceptionMapper implements 
ExceptionMapper<Throwable> {
         if (t instanceof GuacamoleException)
             return Response
                     .status(((GuacamoleException) t).getHttpStatusCode())
-                    .entity(new APIError((GuacamoleException)t))
+                    .entity(new APIError((GuacamoleException) t))
                     .type(MediaType.APPLICATION_JSON)
                     .build();
         
@@ -109,7 +109,8 @@ public class RESTExceptionMapper implements 
ExceptionMapper<Throwable> {
             
         return Response
                 .status(Response.Status.INTERNAL_SERVER_ERROR)
-                .entity("Unexpected Internal Error.")
+                .entity(new APIError(
+                        new GuacamoleException("Unexpected internal error", 
t)))
                 .type(MediaType.APPLICATION_JSON)
                 .build();
         

Reply via email to