Class BaseExceptionMapper<T extends Throwable>
java.lang.Object
com.illumon.iris.db.v2.permissions.rs.BaseExceptionMapper<T>
- Type Parameters:
T
- a subclass ofThrowable
- All Implemented Interfaces:
io.deephaven.shadow.resteasy.javax.ws.rs.ext.ExceptionMapper<T>
- Direct Known Subclasses:
DbAclCheckedExceptionMapper
,DbAclGenericExceptionMapper
,DbAclUnCheckedExceptionMapper
public abstract class BaseExceptionMapper<T extends Throwable>
extends Object
implements io.deephaven.shadow.resteasy.javax.ws.rs.ext.ExceptionMapper<T>
The base implementation of all
ExceptionMapper
for exceptions raised in the acl rest api. Logs the exception
to service and audit logs
The types of exception handled are DbAclCheckedException
DbAclUncheckedException
NullPointerException
Throwable
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract String
getCommandName
(T exception) The name of the command the request uri points to, if NPE or generic error would include the requestURIprotected abstract String
getErrorDetails
(T exception) Part of the error message that is logged, allows implementations to customize what can be includedprotected abstract io.deephaven.shadow.resteasy.javax.ws.rs.core.Response.Status
getResponseStatus
(T exception) Implementations should return the appropriate Response Status to build and propagate in theResponse
static void
handleShadowExceptionMappers
(Throwable throwable, javax.servlet.http.HttpServletRequest request) Convenience method to log in server log and to AuditEventLogger when applicable for exceptions that have shadow mapper implementations.io.deephaven.shadow.resteasy.javax.ws.rs.core.Response
toResponse
(T exception) Logs the exception to server log and Audit Event logs.protected abstract void
updateAuditEventBuilder
(AuditEventBuilder aeBuilder, T exception) The implementations can add customization detail of what to log for inAuditEvent
-
Field Details
-
request
@Context protected javax.servlet.http.HttpServletRequest request
-
-
Constructor Details
-
BaseExceptionMapper
public BaseExceptionMapper()
-
-
Method Details
-
handleShadowExceptionMappers
public static void handleShadowExceptionMappers(Throwable throwable, javax.servlet.http.HttpServletRequest request) Convenience method to log in server log and to AuditEventLogger when applicable for exceptions that have shadow mapper implementations.- Parameters:
throwable
- The exception raised that needs to be loggedrequest
- The HttpServlet request to extract the clientId property
-
toResponse
Logs the exception to server log and Audit Event logs. Maps the exception to the appropriateResponse.Status
and returns the exception seeExceptionMapper
for more details -
getCommandName
The name of the command the request uri points to, if NPE or generic error would include the requestURI- Parameters:
exception
- The exception that has occurred- Returns:
- name of the command the request uri points to
-
getErrorDetails
Part of the error message that is logged, allows implementations to customize what can be included- Parameters:
exception
- The exception that has occurred- Returns:
- string with customized details about the specific error
-
getResponseStatus
protected abstract io.deephaven.shadow.resteasy.javax.ws.rs.core.Response.Status getResponseStatus(@NotNull T exception) Implementations should return the appropriate Response Status to build and propagate in theResponse
- Parameters:
exception
- The thrown exception used to extract the response status- Returns:
- The Response Status for the exception
-
updateAuditEventBuilder
protected abstract void updateAuditEventBuilder(@NotNull AuditEventBuilder aeBuilder, @NotNull T exception) The implementations can add customization detail of what to log for inAuditEvent
- Parameters:
aeBuilder
- The AuditEventBuilder instance being used in building the AuditEvent to logexception
- The thrown exception
-