Interface JourneyFailedWithReason

The journey failed because its step's last attempt reported a failure, with no retry budget left.

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 JourneyFailedWithReason {
    cause: "failure" | "retries exhausted";
    decidedBy: "default";
    errorMessage?: undefined;
    journeyId: JourneyId;
    kind: "journey_failed";
    reason: Reason;
    sequence: number;
    step: StepName;
    timestamp: Timestamp;
    workflow: WorkflowName;
}

Hierarchy

  • Failed
    • JourneyFailedWithReason

Index

cause: "failure" | "retries exhausted"

Why it failed.

decidedBy: "default"

Who decided it.

errorMessage?: undefined

Never present: the last attempt reported a failure, 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 the last attempt reported.

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.