S3 away: read a holder's answer of the kind away as a transport fault

A holder answers error-kind away, with part and words, when a part it
depends on is away; the kept call reads it from the answer and calls again
at the pace. Go: busretry.ErrorKindAway, AwayAnswer, AwayIn, Away;
TypeScript: ERROR_KIND_AWAY, awayAnswer, awayIn.

Builds: design 47 H2 §776, §775; H-A-349 DQ-15, H-A-350 DMC-2, H-A-354
This commit is contained in:
2026-11-21 23:10:27 +01:00
parent d40fa0b3a0
commit 423de0e8a2
6 changed files with 126 additions and 4 deletions
+29
View File
@@ -230,3 +230,32 @@ export function readDefinitionCallers(verb: string, value: unknown, cls?: string
}
return value as string[];
}
/**
* The seat error kind a holder answers when a part it depends on is away (design 47 H2 §776; H-A-349 DQ-15): its
* answer's `error-kind`, beside `part` (what did not answer) and `words`; a caller reads it as a transport fault and
* calls again at the kept-call pace. The Go side's `busretry.ErrorKindAway`.
*/
export const ERROR_KIND_AWAY = "away";
/** A holder's answer of the kind away: `error` and `error-kind` as each seat's error answer has them, with `part` and `words`. */
export interface AwayAnswer {
readonly error: string;
readonly "error-kind": typeof ERROR_KIND_AWAY;
readonly part: string;
readonly words: string;
}
/** The answer of the kind away a holder gives when `part` does not answer (the Go side's `busretry.AwayAnswer`). */
export function awayAnswer(part: string, words: string): AwayAnswer {
return { error: `away: ${part} does not answer: ${words}`, "error-kind": ERROR_KIND_AWAY, part, words };
}
/** The part and words a verb's answer says when its `error-kind` is away, else undefined (the Go side's `busretry.AwayIn`). */
export function awayIn(answer: unknown): { part: string; words: string } | undefined {
if (!answer || typeof answer !== "object" || Array.isArray(answer)) return undefined;
const a = answer as Record<string, unknown>;
if (a["error-kind"] !== ERROR_KIND_AWAY) return undefined;
const str = (v: unknown) => (typeof v === "string" ? v : "");
return { part: str(a.part), words: str(a.words) || str(a.error) };
}