mrserverless/serverless-golang

Use proper AWS API Gateway error handling

mrserverless opened this issue · 0 comments

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."
}