The journey's dispatcher failed while the instance's reporters were added to it.
import assert from "node:assert/strict";import { LocalExecutor, Refusal } from "itinera/executor";import { type Outcome, Step } from "itinera/step";import { Workflow } from "itinera/workflow";class Ship extends Step { override run(): Outcome { return this.succeed(); }}class Orders extends Workflow {}export default (async () => { const orders = Orders.builder() .name("orders") .step(Ship.builder("ship")) .build(); const executor = new LocalExecutor(); const instance = orders.instance(); const running = executor.run(instance); await assert.rejects(executor.run(orders.instance()), { name: "Refusal", refused: { kind: "journey running" }, }); assert.ok((await running).isSucceeded()); await assert.rejects(executor.run(instance), Refusal); await assert.rejects(executor.run(instance), { refused: { kind: "instance ran" }, message: "run refused an instance that already ran: make an instance for each journey", });})(); Copy
import assert from "node:assert/strict";import { LocalExecutor, Refusal } from "itinera/executor";import { type Outcome, Step } from "itinera/step";import { Workflow } from "itinera/workflow";class Ship extends Step { override run(): Outcome { return this.succeed(); }}class Orders extends Workflow {}export default (async () => { const orders = Orders.builder() .name("orders") .step(Ship.builder("ship")) .build(); const executor = new LocalExecutor(); const instance = orders.instance(); const running = executor.run(instance); await assert.rejects(executor.run(orders.instance()), { name: "Refusal", refused: { kind: "journey running" }, }); assert.ok((await running).isSucceeded()); await assert.rejects(executor.run(instance), Refusal); await assert.rejects(executor.run(instance), { refused: { kind: "instance ran" }, message: "run refused an instance that already ran: make an instance for each journey", });})();
Readonly
What the custom code threw, as it was thrown.
The message of what it threw: its message for an Error, and its text otherwise.
message
Error
Tells this refusal from the others.
The journey's dispatcher failed while the instance's reporters were added to it.