$ go run main.go
I hereby claim:
- I am sgarcez on github.
- I am sgarcez (https://keybase.io/sgarcez) on keybase.
- I have a public key ASBIW3PYnxZsuL64I77wEN9eV9_4wnpOo7pquvJXPIKY6Ao
To claim this, I am signing this object:
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
res, err := internal.SamInvoke("../../cloudformation.yaml", "AddTask", `{"note": "foo"}`) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"code": "TASK_NOT_FOUND", | |
"public_message": "Task not found", | |
"private_message": "unknown task: foo-bar" | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
x-amazon-apigateway-gateway-responses: | |
DEFAULT_4XX: | |
defaultResponse: false | |
responseParameters: | |
gatewayresponse.header.Content-Type: "'application/json'" | |
responseTemplates: | |
application/json: | | |
{ | |
"code": "$context.error.responseType", | |
"message": $context.error.messageString |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
x-amazon-apigateway-integration: | |
#... | |
responses: | |
".*\\\"code\\\":\\\"[A-Z_]+_NOT_FOUND\\\".*": | |
statusCode: "404" | |
responseParameters: | |
method.response.header.Content-Type : "'application/json'" | |
responseTemplates: | |
application/json: | | |
#set ($errorMessageObj = $util.parseJson($input.path('$.errorMessage'))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"errorMessage": "{\"code\":\"TASK_NOT_FOUND\",\"public_message\":\"Task not found\",\"private_message\":\"unknown task: foo-bar\"}", | |
"errorType": "lambdaError" | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type lambdaError struct { | |
code string | |
message string | |
origErr error | |
} | |
func (e lambdaError) Error() string { | |
b, err := json.Marshal(e) | |
if err != nil { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"errorMessage": "Uh-oh. Something went wrong", | |
"errorType": "errorString" | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func handler(event json.RawMessage) error { | |
return errors.New(“Uh-oh. Something went wrong”) | |
} |
NewerOlder