Class DurableApiErrorClassifier

java.lang.Object
software.amazon.lambda.durable.util.DurableApiErrorClassifier

public final class DurableApiErrorClassifier extends Object
Classifies AWS service exceptions from Durable Execution API calls as non-retryable or retryable.

Returns UnrecoverableDurableExecutionException with retryable=false for non-retryable customer errors (e.g., KMS key misconfiguration), or retryable=true for retryable errors (throttling, server errors, stale checkpoint tokens).

To add a new non-retryable error, add its error code to NON_RETRYABLE_ERROR_CODES.

  • Method Details

    • classifyException

      public static UnrecoverableDurableExecutionException classifyException(software.amazon.awssdk.awscore.exception.AwsServiceException e)
      Classifies the given exception and returns the appropriate exception to throw.

      Returns UnrecoverableDurableExecutionException with retryable=false for non-retryable customer errors, or retryable=true for retryable errors.

      Classification rules:

      • Error code in NON_RETRYABLE_ERROR_CODES → non-retryable (retryable=false)
      • 4xx + "Invalid Checkpoint Token" → retryable (retryable=true, stale token resolves on retry)
      • 4xx (non-429) → non-retryable (retryable=false, customer error)
      • 429, 5xx, unknown → retryable (retryable=true)
      Parameters:
      e - the AWS service exception from a Durable Execution API call
      Returns:
      an UnrecoverableDurableExecutionException for all cases, with the retryable flag set accordingly