Error thrown when a workflow detects a pending cancellation request. Workflows can catch this error to perform cleanup before terminating.

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

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

try {
await acts.longRunningTask();
} catch (err) {
if (Durable.workflow.isCancellation(err)) {
await CancellationScope.nonCancellable(async () => {
await acts.cleanup();
});
return 'cancelled-with-cleanup';
}
throw err;
}
return 'done';
}

Hierarchy

  • Error
    • CancelledFailure

Constructors

Properties

Constructors

Properties

type: string = 'CancelledFailure'