mrserverless / serverless-golang

AWS Lambda Go functions using Serverless Framework and Python shim
Other
302 stars 21 forks source link

Use proper AWS API Gateway error handling #32

Open mrserverless opened 6 years ago

mrserverless commented 6 years ago

As per documentation:

https://aws.amazon.com/blogs/compute/error-handling-patterns-in-amazon-api-gateway-and-aws-lambda/

Errors should return with either prefixes:

[BadRequest] | 400
[Forbidden] | 403
[NotFound] | 404
[InternalServerError] | 500

Or as the following payload:

{
    "errorType" : "InternalServerError",
    "httpStatus" : 500,
    "requestId" : "<context.awsRequestId>",
    "message" : "An unknown error has occurred. Please try again."
}