public final class WuiExceptionMapper extends Object implements ExceptionMapper<Exception>
WuiException instances to a REST response representing an ErrorReport.
Mapping rules:
WuiException instances are mapped directly.WebApplicationException instances holding a WuiException instance as a cause are mapped
preserving the underlying WuiException message and status. Exception info is filled from the top level
exception. This can happen for example when a WuiException is thrown from a ParamConverter
implementation. In this case the thrown exception is wrapped in a container specific exception holding the
thrown WuiException as its cause.WebApplicationException instances mapped by preserving their status only, not their
whole response returned by WebApplicationException.getResponse().Exception instances are mapped with Response.Status#INTERNAL_SERVER_ERROR statusNote that org.codehaus.jackson.JsonParseException instances are mapped by
JacksonJsonParseExceptionMapper.
| Constructor and Description |
|---|
WuiExceptionMapper() |
| Modifier and Type | Method and Description |
|---|---|
static void |
addErrorReportListener(Sink<ErrorReport> listener)
Add a listener for mapped error reports.
|
Response |
toResponse(Exception exception) |
public Response toResponse(Exception exception)
toResponse in interface ExceptionMapper<Exception>public static void addErrorReportListener(Sink<ErrorReport> listener)
listener - Listener to call when an Exception is mapped.