• Type guard that returns true if an error is a Durable engine control-flow signal rather than a genuine application error.

    Durable uses thrown errors internally to suspend workflow execution for durable operations like sleepFor, waitFor, proxyActivities, and execChild. These errors must be re-thrown (not swallowed) so the engine can persist state and schedule the next step.

    Always use didInterrupt in catch blocks inside workflow functions to avoid accidentally swallowing engine signals.

    DurableChildError, DurableFatalError, DurableMaxedError, DurableProxyError, DurableRetryError, DurableSleepError, DurableTimeoutError, DurableWaitForError, DurableWaitForAllError

    import { Durable } from '@hotmeshio/hotmesh';

    export async function safeWorkflow(): Promise<string> {
    const { riskyOperation } = Durable.workflow.proxyActivities<typeof activities>();

    try {
    return await riskyOperation();
    } catch (error) {
    // CRITICAL: re-throw engine signals
    if (Durable.workflow.didInterrupt(error)) {
    throw error;
    }
    // Handle real application errors
    return 'fallback-value';
    }
    }
    // Common pattern in interceptors
    const interceptor: WorkflowInterceptor = {
    async execute(ctx, next) {
    try {
    return await next();
    } catch (error) {
    if (Durable.workflow.didInterrupt(error)) {
    throw error; // always re-throw engine signals
    }
    // Log and re-throw application errors
    console.error('Workflow failed:', error);
    throw error;
    }
    },
    };

    Parameters

    • error: Error

      The error to check.

    Returns boolean

    true if the error is a Durable engine interruption signal.