Interface ServerErrorHandler


  • public interface ServerErrorHandler
    An object that can deal with errors that occur during the processing of an exchange. Typically retrieved from the exchange service.
    See Also:
    Context.error(Throwable)
    • Field Detail

      • TYPE

        static final com.google.common.reflect.TypeToken<ServerErrorHandler> TYPE
        A type token for this type.
        Since:
        1.1
    • Method Detail

      • error

        @NonBlocking
        void error​(Context context,
                   Throwable throwable)
            throws Exception
        Processes the given exception that occurred processing the given context.

        Implementations should strive to avoid throwing exceptions. If exceptions are thrown, they will just be logged at a warning level and the response will be finalised with a 500 error code and empty body.

        Parameters:
        context - The context being processed
        throwable - The throwable that occurred
        Throws:
        Exception - if something goes wrong handling the error
      • error

        @NonBlocking
        default void error​(Context context,
                           InvalidPathEncodingException exception)
                    throws Exception
        Processes the given request path encoding error that occurred processing the given context.

        Implementations should strive to avoid throwing exceptions. If exceptions are thrown, they will just be logged at a warning level and the response will be finalised with a 500 error code and empty body.

        Parameters:
        context - The context being processed
        exception - The path encoding error that occurred
        Throws:
        Exception - if something goes wrong handling the error
        Since:
        1.5