I am working on a Step Function in CDK that is mostly just a chain of Lambdas;
lambda_1
.next(lambda_2)
.next(lambda_3)
.next(lambda_4)
.next(lambda_5)
Whenever any of the Lambdas throws an error (handled or unhandled) I need to be able to log the error, which I intend to do in another Lambda as I need to perform some cleaning. Now, I can do this by triggering the Lambda from the Step-Function-Failed event, but for visibility I’d rather keep the logging as a step in the Step Function. I’ve reviewed the documentation, can’t find a generic place that the addCatch
method is available.
Is there any way to add a catch to a Step Function in CDK to catch errors thrown by all steps?