GitHub user necouchman opened a pull request:
https://github.com/apache/guacamole-client/pull/291
GUACAMOLE-566: Replace RESTExceptionWrapper with GuacamoleExceptionMapper
Per the discussion on the mailing list ([1]) this change implements the
`GuacamoleExceptionMapper` class that will map all instances of
`GuacamoleException` thrown in the web client to a JSON error message. This
works not only for the main REST interfaces but also for any custom-built
extension interfaces. Additionally, I believe I was able to successfully map
the rest of the `RESTExceptionWrapper` class into the new class, so I've
removed that class entirely. The interface appears to work fine with that
removed, but I very well may have missed corner cases or other items that need
to be validated, so that's worth a careful look before this gets merged.
This change does allow the error messages from my custom REST API in
GUACAMOLE-38 to pass through successfully, so, overall, the implementation of
the `ExceptionMapper<GuacamoleException>` appears to work well.
[1] -
http://mail-archives.apache.org/mod_mbox/guacamole-dev/201805.mbox/%3CCALKeL-PmkxqcmcyC15rBjJ_FZpTHAQqOUHrpyoQsAQA=m9g...@mail.gmail.com%3E
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/necouchman/guacamole-client jira/566
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/guacamole-client/pull/291.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #291
----
commit a60377486552176a745e5000c70658a4c96f678b
Author: Nick Couchman <vnick@...>
Date: 2018-05-29T01:05:11Z
GUACAMOLE-566: Implement GuacamoleExceptionMapper to deal with
exceptions thrown in REST APIs in extensions.
commit eb91f4d87a408ff82a308fe9f45069771d5ba1aa
Author: Nick Couchman <vnick@...>
Date: 2018-05-29T21:24:54Z
GUACAMOLE-566: Replace the entire RESTExceptionWrapper with the
ExceptionMapper implementation.
commit 399f7e15adbf9e187b499068118a072f2a97a300
Author: Nick Couchman <vnick@...>
Date: 2018-05-29T22:00:44Z
GUACAMOLE-566: Remove debug code.
commit 75c8fc856b1f6c1d9b3fb7b69b9128add4f1cda3
Author: Nick Couchman <vnick@...>
Date: 2018-05-29T22:01:54Z
GUACAMOLE-566: Remove silly unnecessary space.
commit 69174d4bdf5a6bfaed3c4dba5919f817e908adfb
Author: Nick Couchman <vnick@...>
Date: 2018-05-29T22:03:25Z
GUACAMOLE-566: Remove Singleton for Exception Mapper class.
----
---