TooEarlyError
Thrown when a request is made before the system is ready to process it.
TooEarlyError is thrown by world implementations when a request is made before the system is ready to process it. It corresponds to HTTP 425 Too Early semantics.
The retryAfter property contains the number of seconds to wait before retrying.
The Workflow runtime handles this error automatically by retrying after the specified delay. You will only encounter it when interacting with world storage APIs directly.
import { TooEarlyError } from "workflow/errors"
declare const world: { events: { create(...args: any[]): Promise<any> } }; // @setup
declare const runId: string; // @setup
declare const event: any; // @setup
try {
await world.events.create(runId, event);
} catch (error) {
if (TooEarlyError.is(error)) {
console.log(`Retry after ${error.retryAfter} seconds`);
}
}API Signature
Properties
| Name | Type | Description |
|---|---|---|
retryAfter | number | Delay in seconds before the operation can be retried. Present when the server sends a Retry-After header. |
message | string | The error message. |
Static Methods
TooEarlyError.is(value)
Type-safe check for TooEarlyError instances. Preferred over instanceof because it works across module boundaries and VM contexts.
import { TooEarlyError } from "workflow/errors"
declare const error: unknown; // @setup
if (TooEarlyError.is(error)) {
// error is typed as TooEarlyError
}