Class BaseExceptionMapper<T extends Throwable>

java.lang.Object
com.illumon.iris.db.v2.permissions.rs.BaseExceptionMapper<T>
Type Parameters:
T - a subclass of Throwable
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
    Modifier and Type
    Field
    Description
    protected javax.servlet.http.HttpServletRequest
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected abstract String
    getCommandName(T exception)
    The name of the command the request uri points to, if NPE or generic error would include the requestURI
    protected abstract String
    getErrorDetails(T exception)
    Part of the error message that is logged, allows implementations to customize what can be included
    protected 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 the Response
    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
    The implementations can add customization detail of what to log for in AuditEvent

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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 logged
      request - The HttpServlet request to extract the clientId property
    • toResponse

      public io.deephaven.shadow.resteasy.javax.ws.rs.core.Response toResponse(T exception)
      Logs the exception to server log and Audit Event logs. Maps the exception to the appropriate Response.Status and returns the exception see ExceptionMapper for more details
      Specified by:
      toResponse in interface io.deephaven.shadow.resteasy.javax.ws.rs.ext.ExceptionMapper<T extends Throwable>
      Parameters:
      exception - the exception to map to a response.
      Returns:
      The Error Response published back to the client
    • getCommandName

      protected abstract String getCommandName(@NotNull T exception)
      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

      protected abstract String getErrorDetails(@NotNull T exception)
      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 the Response
      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 in AuditEvent
      Parameters:
      aeBuilder - The AuditEventBuilder instance being used in building the AuditEvent to log
      exception - The thrown exception