title: Retry and Catch on AWS Step Function task
body: <p>For StepFunctions, can we have both <code>Retry</code> and <code>Catch</code> working together on the exhausted case?</p>
  <p>Here is my use case</p>
  <ol>
  <li>Job fails</li>
  <li>Retry</li>
  <li>Retries exhausted, goes to Catch</li>
  <li>Catch all errors, move to next job, and update the DB table to mark this job failed (another task)</li>
  <li>Or on success from 1st time run or retries, move to the next job</li>
  </ol>
  <pre class="lang-json prettyprint-override"><code>    &quot;ExecuteMyJob&quot;: {
              &quot;Type&quot;: &quot;Task&quot;,
              &quot;Resource&quot;: &quot;arn:aws:states:::glue:startJobRun.sync&quot;,
              &quot;Parameters&quot;: {
                  &quot;JobName.$&quot;: &quot;$.jobName&quot;,
                  &quot;Arguments.$&quot;: &quot;$.jobArguments&quot;
              },
              &quot;Retry&quot; : [{
                  &quot;ErrorEquals&quot;: [ &quot;States.TaskFailed&quot;, &quot;States.Runtime&quot; ],
                  &quot;MaxAttempts&quot;: 3,
                  &quot;IntervalSeconds&quot;: 60,
                  &quot;BackoffRate&quot;: 2
              }],
              &quot;Catch&quot;: [{
                  &quot;ErrorEquals&quot;: [ &quot;States.ALL&quot; ],
                  &quot;Next&quot;: &quot;MarkJobFailOnDbTable&quot;
              }],
              &quot;Next&quot;: &quot;NextJobOnPreviousSuccess&quot;
          }
  </code></pre>