If my Lambda throws an Exception with the message 404 then the response as seen in API Gateway is
{
"errorMessage":"404",
"errorType":"java.lang.Exception",
"stackTrace":[..."]
}
and I can match on the errorMessage to affect the HTTP result.
However if I return effectively the same result, viz:
{
"errorMessage":"404",
"errorType":"Error"
}
API Gateway doesn't seem to recognise that there is an error and always returns a 200.
Is there any way for my nice functional code to signal an error without throwing an exception?