Interface StepGivenUpByDefault

A step given up by the executor's own rule.

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 StepGivenUpByDefault {
    attempt: Attempt;
    cause: "failure" | "retries exhausted" | "abnormal termination";
    decidedBy: "default";
    journeyId: JourneyId;
    kind: "step_given_up";
    reason?: undefined;
    sequence: number;
    step: StepName;
    timestamp: Timestamp;
    workflow: WorkflowName;
}

Hierarchy (View Summary)

Index

attempt: Attempt

The attempt.

cause: "failure" | "retries exhausted" | "abnormal termination"

Why it will not be attempted again.

decidedBy: "default"

Who decided it.

journeyId: JourneyId

The journey's ID.

kind: "step_given_up"

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

reason?: undefined

Never present: only FailWorkflow carries a reason.

sequence: number

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

step: StepName

The step's name.

timestamp: Timestamp

When the event was emitted.

workflow: WorkflowName

The workflow's name.