Skip to main content
An error that can be retried with configurable retry timing. When thrown from a step function, the step will be retried after the specified delay.

Constructor

Parameters

string
required
The error message describing what went wrong.
RetryableErrorOptions
Configuration options for the retry behavior.

Properties

string
Always set to "RetryableError".
string
The error message provided to the constructor.
Date
The Date when the step should be retried.
string
The stack trace where the error was thrown.

Static Methods

(value: unknown) => boolean
Type guard to check if a value is a RetryableError.

Usage

Basic Retry

Retry with default 1 second delay:

Custom Retry Delay (Duration String)

Specify retry delay as a duration string:

Custom Retry Delay (Milliseconds)

Specify retry delay in milliseconds:

Retry at Specific Time

Schedule retry for a specific date/time:

Exponential Backoff

Implement exponential backoff using step metadata:

Rate Limit Handling

Handle API rate limits:

Conditional Retry Logic

Decide retry strategy based on error type:

Max Attempts with Retry

Limit retry attempts:

Type Guard Usage

Check if an error is retryable:

Long Delays

Retry after extended periods:

Duration Format

The retryAfter option accepts duration strings in the following formats:
  • "1000ms" - Milliseconds
  • "1s" - Seconds
  • "1m" - Minutes
  • "1h" - Hours
  • "1d" - Days

Default Behavior

If retryAfter is not specified, the step will be retried after 1 second (1000 milliseconds).

Notes

  • Retryable errors cause the step to be retried after the specified delay
  • The step will be re-executed from the beginning on each retry
  • Use getStepMetadata().attempt to track the current attempt number
  • Combine with FatalError to handle different error scenarios
  • The retryAfter date is calculated at the time the error is thrown
  • Very long retry delays (hours/days) are supported