Reputation: 1274
My issue is as follows - I have a lambda function attached to API gateway, where i map some error codes using integration response.
The thing is, i can only map errors if the lambda function fails (throws an exception).
This makes the "Errors" metric kick in - https://docs.aws.amazon.com/lambda/latest/dg/monitoring-metrics.html#monitoring-metrics-invocation
We monitor this metric, and we get now email alerts also there's an exception for invalid input, or something else that is fixable by the user (and should not trigger an error metric).
Is there any way to ignore certain errors from being written as an error metric?
Thanks.
Upvotes: 1
Views: 1150
Reputation: 3387
The way I see it, if you know exactly which kinds of errors you want to ignore, you should use try ... except
blocks (or equivalent, depending on which language you use) in your lambda targeting those specific errors.
This way you can initiate graceful exit without failing lambda execution.
Upvotes: 1