Package com.amazonaws.serverless.proxy
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:
-
Method Summary
Modifier and TypeMethodDescriptionThe handle method is called by the container object whenever an exception occurs in theproxymethod for typed callsvoidhandle(Throwable ex, OutputStream stream) This handle implementation is called whenever an exception occurs in the stream-basedproxymethod.
-
Method Details
-
handle
The handle method is called by the container object whenever an exception occurs in theproxymethod for typed calls- Parameters:
ex- The exception thrown by the application- Returns:
- A valid response object
-
handle
This handle implementation is called whenever an exception occurs in the stream-basedproxymethod.- Parameters:
ex- The exception thrown by the applicationstream- The OutputStream where the exception will be written- Throws:
IOException- When the exception handler fails to write to the OutputStream
-