I'm using step functions on AWS. Consider the state machine made up of lambdas:
"StartAt": "Metadata",
"States": {
"Metadata": {
"Type": "Task",
"Resource": "${metadataArn}",
"Next": "StoreMetadata",
"Retry" : [
{
"ErrorEquals": [ "States.All" ],
"IntervalSeconds": 2,
"MaxAttempts": 3
}
],
"Catch": [
{
"ErrorEquals": [ "States.All" ],
"Next": "ErrorHandler"
}
]
} ...
...
How can I pass particular data to the "ErrorHandler". For example, the step that failed, maybe a piece of data. I'm using nodejs but can extrapolate to any runtime.
For example in node we might have a lambda where:
module.exports.handler = async input => {
const ids = JSON.parse(input).ids
// try to read in data for ids.
// read fails / throws exception
}
How can I have the error handler get the array of ids so I can mark them as failed? if this "ErrorHandler" is the catch for multiple steps how can I have it know which steps failed?