workflow
Version:
Workflow SDK - Build durable, resilient, and observable workflows
67 lines (50 loc) • 1.53 kB
text/mdx
---
title: FatalError
description: Throw to mark a step as permanently failed without retrying.
type: reference
summary: Throw FatalError in a step to mark it as permanently failed and prevent retries.
prerequisites:
- /docs/foundations/errors-and-retries
related:
- /docs/api-reference/workflow/retryable-error
---
When a `FatalError` is thrown in a step, it indicates that the workflow should not retry a step, marking it as failure.
You should use this when you don't want a specific step to retry.
```typescript lineNumbers
import { FatalError } from "workflow"
async function fallibleWorkflow() {
"use workflow"
await fallibleStep();
}
async function fallibleStep() {
"use step"
throw new FatalError("Fallible!") // [!code highlight]
}
```
## API signature
### Constructor
`new FatalError(message)`
| Parameter | Type | Description |
| --------- | -------- | ------------------ |
| `message` | `string` | The error message. |
### Properties
<TSDoc
definition={`
interface FatalError {
/** The error message. */
message: string;
/** Always true. Marks the error as non-retryable. */
fatal: boolean;
}
export default FatalError;`}
/>
### Static methods
#### `FatalError.is(value)`
Type-safe check for `FatalError` instances. Preferred over `instanceof` because it works across module boundaries and VM contexts.
```typescript
import { FatalError } from "workflow"
declare const error: unknown; // @setup
if (FatalError.is(error)) {
// error is typed as FatalError
}
```