Interface JourneyFailedByHook

The journey failed because a hook of the step returned FailWorkflow.

import type { DecidedBy, Event, GiveUpHook } from "itinera/event";

function decider(decidedBy: DecidedBy): string {
return decidedBy === "default"
? "by default"
: `by ${decidedBy.policy}, ${decidedBy.hook}`;
}

export function givenUpAfter(hook: GiveUpHook): string {
return hook === "on step retry"
? "before a retry"
: "after an abnormal termination";
}

export function decision(event: Event): string | undefined {
if (event.kind === "step_given_up") {
return `${event.step} given up: ${event.cause}, ${decider(event.decidedBy)}`;
}
if (event.kind === "journey_failed" || event.kind === "journey_succeeded") {
return `${event.kind} ${decider(event.decidedBy)}`;
}
return undefined;
}
interface JourneyFailedByHook {
    cause: "FailWorkflow";
    decidedBy: DecidingHook;
    errorMessage?: undefined;
    journeyId: JourneyId;
    kind: "journey_failed";
    reason: Reason;
    sequence: number;
    step: StepName;
    timestamp: Timestamp;
    workflow: WorkflowName;
}

Hierarchy

  • Failed
    • JourneyFailedByHook

Index

cause: "FailWorkflow"

Why it failed.

decidedBy: DecidingHook

The hook that returned it.

errorMessage?: undefined

Never present: a hook failed the journey, with no error.

journeyId: JourneyId

The journey's ID.

kind: "journey_failed"

The event's kind, which tells what else it carries.

reason: Reason

The reason FailWorkflow carried.

sequence: number

The event's position in its journey's event stream, from 1.

step: StepName

The name of the step that failed.

timestamp: Timestamp

When the event was emitted.

workflow: WorkflowName

The workflow's name.