Class SimpleExceptionHandler<E extends java.lang.Throwable>

  • Type Parameters:
    E - the type of exception
    All Implemented Interfaces:
    ExceptionHandler, HttpServerComponent

    public abstract class SimpleExceptionHandler<E extends java.lang.Throwable>
    extends java.lang.Object
    implements ExceptionHandler
    The abstract implementation of ExceptionHandler which allows to explicit only handle a specific type of exceptions.
    • Constructor Detail

      • SimpleExceptionHandler

        protected SimpleExceptionHandler()
      • SimpleExceptionHandler

        protected SimpleExceptionHandler​(java.lang.Class<? extends E> type)
    • Method Detail

      • acceptCause

        public boolean acceptCause​(java.lang.Throwable cause)
        Returns true if the given cause should be handled.
        Parameters:
        cause - the cause
        Returns:
        true if the given cause should be handled
      • handle

        public java.util.Optional<java.util.concurrent.CompletionStage<HttpResult>> handle​(HttpRequestContext ctx,
                                                                                           java.lang.Throwable cause)
        Description copied from interface: ExceptionHandler
        Handles the exception.
        Specified by:
        handle in interface ExceptionHandler
        Parameters:
        ctx - the HttpRequestContext
        cause - the cause to handle
        Returns:
        an Optional<CompletionStage<HttpResult>>
      • handle0

        protected abstract java.util.concurrent.CompletionStage<HttpResult> handle0​(HttpRequestContext ctx,
                                                                                    E cause)
        Is called for each exception for type SimpleExceptionHandler.
        Parameters:
        ctx - the HttpRequestContext}
        cause - the cause to handle
        Returns:
        a CompletionStage<HttpResult>