WorkflowError
Base class for all workflow error types.
WorkflowError is the base class that all Workflow SDK error types extend, such as WorkflowRunFailedError and HookNotFoundError. It extends Error with an optional cause and, for some subclasses, a link to the relevant error documentation appended to the message.
import { WorkflowError } from "workflow/errors"
const error = new WorkflowError("something went wrong", {
cause: new Error("underlying cause"),
});API Signature
Properties
| Name | Type | Description |
|---|---|---|
message | string | The error message. |
cause | unknown | The underlying cause, when provided. |
Static Methods
WorkflowError.is(value)
Type-safe check for WorkflowError instances. Preferred over instanceof because it works across module boundaries and VM contexts.
WorkflowError.is() matches only direct WorkflowError instances — not subclasses, which override the error name it checks. To handle a specific error type, use that subclass's own .is() method (e.g. WorkflowRunFailedError.is(error)).
import { WorkflowError } from "workflow/errors"
declare const error: unknown; // @setup
if (WorkflowError.is(error)) {
// error is typed as WorkflowError
}