Package com.amazonaws.serverless.proxy
Class AwsProxyExceptionHandler
java.lang.Object
com.amazonaws.serverless.proxy.AwsProxyExceptionHandler
- All Implemented Interfaces:
ExceptionHandler<AwsProxyResponse>
Default implementation of the
ExceptionHandler object that returns AwsProxyResponse objects.
Returns application/json messages with a status code of 500 when the RequestReader failed to read the incoming event
or if InternalServerErrorException is thrown.
For all other exceptions returns a 502. Responses are populated with a JSON object containing a message property.- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected StringgetErrorJson(String message) The 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.
-
Field Details
-
HEADERS
-
-
Constructor Details
-
AwsProxyExceptionHandler
public AwsProxyExceptionHandler()
-
-
Method Details
-
handle
Description copied from interface:ExceptionHandlerThe handle method is called by the container object whenever an exception occurs in theproxymethod for typed calls- Specified by:
handlein interfaceExceptionHandler<AwsProxyResponse>- Parameters:
ex- The exception thrown by the application- Returns:
- A valid response object
-
handle
Description copied from interface:ExceptionHandlerThis handle implementation is called whenever an exception occurs in the stream-basedproxymethod.- Specified by:
handlein interfaceExceptionHandler<AwsProxyResponse>- 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
-
getErrorJson
-