One attempt of a step, counted from 1: the first execution of a step is its first attempt, and each retry is the next. Only itinera makes one.
It writes itself as its number, in a template string and in JSON.
import assert from "node:assert/strict";import { Attempt } from "itinera/step";function label(attempt: Attempt): string { return attempt.isFirst() ? "first try" : `retry, attempt ${attempt.toString()}`;}assert.equal(label(Attempt.first), "first try");assert.equal(Attempt.first.number, 1);assert.equal(JSON.stringify({ attempt: Attempt.first }), '{"attempt":1}'); Copy
import assert from "node:assert/strict";import { Attempt } from "itinera/step";function label(attempt: Attempt): string { return attempt.isFirst() ? "first try" : `retry, attempt ${attempt.toString()}`;}assert.equal(label(Attempt.first), "first try");assert.equal(Attempt.first.number, 1);assert.equal(JSON.stringify({ attempt: Attempt.first }), '{"attempt":1}');
Readonly
The attempt's number, from 1.
Static
The first attempt of a step.
Whether this is the first attempt of its step.
The attempt's number, which is how JSON.stringify writes it.
JSON.stringify
The attempt's number, as text.
One attempt of a step, counted from 1: the first execution of a step is its first attempt, and each retry is the next. Only itinera makes one.
It writes itself as its number, in a template string and in JSON.