Capture Exception in handler with 500 status code

This commit is contained in:
Florian Motlik 2016-09-02 17:02:30 +02:00
parent 41260b834e
commit bb2ca44623
2 changed files with 10 additions and 7 deletions

View File

@ -99,19 +99,19 @@ module.exports = {
"method": "$context.httpMethod",
"principalId": "$context.authorizer.principalId",
"stage": "$context.stage",
#set( $map = $input.params().header )
"headers": $loop,
#set( $map = $input.params().querystring )
"query": $loop,
#set( $map = $input.params().path )
"path": $loop,
#set( $map = $context.identity )
"identity": $loop,
#set( $map = $stageVariables )
"stageVariables": $loop
}
@ -331,7 +331,9 @@ module.exports = {
{ StatusCode: 403, SelectionPattern: '.*\\[403\\].*' },
{ StatusCode: 404, SelectionPattern: '.*\\[404\\].*' },
{ StatusCode: 422, SelectionPattern: '.*\\[422\\].*' },
{ StatusCode: 500, SelectionPattern: '.*\\[500\\].*' },
{ StatusCode: 500,
SelectionPattern:
'.*(Process\\s?exited\\s?before\\s?completing\\s?request|\\[500\\]).*' },
{ StatusCode: 502, SelectionPattern: '.*\\[502\\].*' },
{ StatusCode: 504, SelectionPattern: '.*\\[504\\].*' }
);

View File

@ -664,7 +664,8 @@ describe('#compileMethods()', () => {
expect(
awsCompileApigEvents.serverless.service.provider.compiledCloudFormationTemplate
.Resources.ApiGatewayMethodUsersListGet.Properties.Integration.IntegrationResponses[6]
).to.deep.equal({ StatusCode: 500, SelectionPattern: '.*\\[500\\].*' });
).to.deep.equal({ StatusCode: 500,
SelectionPattern: '.*(Process\\s?exited\\s?before\\s?completing\\s?request|\\[500\\]).*' });
expect(
awsCompileApigEvents.serverless.service.provider.compiledCloudFormationTemplate
.Resources.ApiGatewayMethodUsersListGet.Properties.Integration.IntegrationResponses[7]