Make the failure as Lambda result with HTTP status code 4xx, 5xx #643
Replies: 1 comment 1 reply
-
You likely want to leave the function's return value as So you should consider whether the entire application has now failed (thus return an |
Beta Was this translation helpful? Give feedback.
-
I'm creating an HTTP response using the following code:
I've also created this for 4xx and 5xx status codes, but since it ultimately returns an Ok from Lambda, the execution result of Lambda is considered "successful" rather than "failed". I would like the Lambda result to be treated as a failure when it's not a 2xx status code, so I want to return an Err at the end while setting the status code.
(My understanding is that if the Lambda Function returns Ok(), it is considered "success" and if it returns Err(), it is considered "failure", is that correct?)
How can I achieve this scenario?
Beta Was this translation helpful? Give feedback.
All reactions