I have Python based Lambda which is integrated with API Gateway and try to handle lambda exception below.
{
"stackTrace": [
[
"/var/task/index.py",
14,
"handler",
"raise Exception(err)"
]
],
"errorType": "Exception",
"errorMessage": "device name existed"
}
I've defined HTTP status 400 of Method Response for the exception.
I also defined "Lambda Error Regex" and "Body Mapping Templates".
But the API Gateway still responses HTTP status 200 instead of 400 when my lambda raised an exception.
Anyone has idea what's going wrong. Did I miss something?