FatalError
Throw to mark a step as permanently failed without retrying.
When a FatalError is thrown in a step, the step fails without retrying and the error bubbles back to the workflow logic.
Use FatalError when a failure is intentional or unrecoverable and retrying would be wasteful or harmful.
import { FatalError } from "workflow"
async function fallibleWorkflow() {
"use workflow"
await fallibleStep();
}
async function fallibleStep() {
"use step"
throw new FatalError("Fallible!")
}API Signature
Constructor
new FatalError(message: string)| Parameter | Type | Description |
|---|---|---|
message | string | The error message |
Instance Properties
| Property | Type | Description |
|---|---|---|
fatal | boolean | Always initialized to true. Marks the error as non-retryable. |
Static Methods
FatalError.is(value)
FatalError.is(value: unknown): value is FatalErrorReturns true if value is a FatalError instance. Useful for checking caught errors without instanceof.