Interface ExceptionHandlerAware

    • Method Summary

      All Methods Instance Methods Abstract Methods Default Methods 
      Modifier and Type Method Description
      default void addHandler​(ExceptionHandler handler)
      Add a handler to the default pipeline.
      default void addHandler​(ExceptionHandler handler, java.lang.Class<? extends java.lang.Exception> clazz)
      Add a handler to an exception specific pipeline.
      java.util.Map<java.lang.Class<? extends java.lang.Exception>,​java.util.List<ExceptionHandler>> getExceptionHandlers()  
      default java.lang.Exception handle​(java.lang.Exception e)
      Execute the pipeline by starting with the specific pipeline for the exception followed by the default pipeline.
      default void removeHandler​(ExceptionHandler handler)
      Remove a handler from the default pipeline.
      default void removeHandler​(ExceptionHandler handler, java.lang.Class<? extends java.lang.Exception> clazz)
      Remove a handler from an exception specific handler pipeline.
      default void removeHandlers​(java.lang.Class<? extends java.lang.Exception> clazz)
      Remove all handler for a specific exception handling pipeline.
    • Method Detail

      • getExceptionHandlers

        java.util.Map<java.lang.Class<? extends java.lang.Exception>,​java.util.List<ExceptionHandler>> getExceptionHandlers()
        Returns:
        A map of exception classes to exception handlers. These handlers only execute if the exception matches.
      • addHandler

        default void addHandler​(ExceptionHandler handler)
        Add a handler to the default pipeline.
        Parameters:
        handler - ExceptionHandler to add.
      • addHandler

        default void addHandler​(ExceptionHandler handler,
                                java.lang.Class<? extends java.lang.Exception> clazz)
        Add a handler to an exception specific pipeline.
        Parameters:
        handler - ExceptionHandler to add.
        clazz - Exception handler pipeline to add it to.
      • removeHandler

        default void removeHandler​(ExceptionHandler handler)
        Remove a handler from the default pipeline.
        Parameters:
        handler - ExceptionHandler to remove.
      • removeHandler

        default void removeHandler​(ExceptionHandler handler,
                                   java.lang.Class<? extends java.lang.Exception> clazz)
        Remove a handler from an exception specific handler pipeline. The list of exception handlers is removed once the last handler has been removed.
        Parameters:
        handler - ExceptionHandler to remove.
        clazz - Exception pipeline to remove it from.
      • removeHandlers

        default void removeHandlers​(java.lang.Class<? extends java.lang.Exception> clazz)
        Remove all handler for a specific exception handling pipeline.
        Parameters:
        clazz - Exception pipeline to remove.
      • handle

        default java.lang.Exception handle​(java.lang.Exception e)
                                    throws java.lang.Exception
        Execute the pipeline by starting with the specific pipeline for the exception followed by the default pipeline.
        In the event of both pipelines being empty, the original exception is rethrown.
        Parameters:
        e - Initial exception.
        Returns:
        Same, modified or new exception.
        Throws:
        java.lang.Exception - In the event of a handler throwing an exception. Processing by further handlers would be cancelled.