Interface JourneyFailedWithError

The journey failed because its step's last attempt ended in an abnormal termination that was not retried.

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

Hierarchy

  • Failed
    • JourneyFailedWithError

Index

cause: "retries exhausted" | "abnormal termination"

Why it failed.

decidedBy: "default"

Who decided it.

errorMessage: string

The message of the error that ended the last attempt.

journeyId: JourneyId

The journey's ID.

kind: "journey_failed"

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

reason?: undefined

Never present: the last attempt ended abnormally, with no reason.

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.