Interface ExceptionHandler<ResponseType>

Type Parameters:
ResponseType - The type for the Lambda return value. Implementing sub-classes are required to return a valid instance of the response type.
All Known Implementing Classes:
AwsProxyExceptionHandler

public interface ExceptionHandler<ResponseType>
Implementing sub-classes of this interface are used by container objects to handle exceptions. Normally, exceptions are handled by the client applications directly within the container and a valid HTTP response is expected. This handler is used for exceptions thrown by the library while marshalling and unmarshalling requests and responses. The interface declares two methods. A typed handle method for requests that are being proxied using a request and response type LambdaContainerHandler, and a stream-based handle method for Lambda's RequestStreamHandler.
See Also:
LambdaContainerHandler
  • Method Summary

    Modifier and Type
    Method
    Description
    The handle method is called by the container object whenever an exception occurs in the proxy method for typed calls
    void
    handle​(Throwable ex, OutputStream stream)
    This handle implementation is called whenever an exception occurs in the stream-based proxy method.
  • Method Details

    • handle

      ResponseType handle(Throwable ex)
      The handle method is called by the container object whenever an exception occurs in the proxy method for typed calls
      Parameters:
      ex - The exception thrown by the application
      Returns:
      A valid response object
    • handle

      void handle(Throwable ex, OutputStream stream) throws IOException
      This handle implementation is called whenever an exception occurs in the stream-based proxy method.
      Parameters:
      ex - The exception thrown by the application
      stream - The OutputStream where the exception will be written
      Throws:
      IOException - When the exception handler fails to write to the OutputStream