AWS Step Function Lambda error catch clause custom error with new fields
Solution 1:
Unfortunately there is no handy way to handle such case. A workaround is using an extra state with builtin intrinsic function States.StringToJson
:
"Catch": [ {
"ErrorEquals": [ "States.ALL" ],
"ResultPath": "$.error-info",
"Next": "Error Handler Preprocessing"
}]
...
"Error Handler Preprocessing": {
"Type": "Pass",
"Parameters": {
"Error.$": "$.error-info.Error",
"Cause.$": "States.StringToJson($.error-info.Cause)"
},
"ResultPath": "$.error-info",
"Next": "Error Handler"
},
"Error Handler": {
"Type": "Task",
...
}
References
- https://docs.aws.amazon.com/step-functions/latest/dg/amazon-states-language-intrinsic-functions.html