Skip to content

classifyStructuredFailure

classifyStructuredFailure(error, timeoutMs): StructuredFailureKind

Defined in: packages/core/src/runtime/askStructured.ts:84

Name which failure happened, given the error string and the budget the call was made with.

The single place the three classes are told apart. A stall and a rejection are the two failures a reader has to distinguish first and the two that look most alike from the outside — a red that cannot say which happened sends the reader to re-run a real defect, or to investigate a provider hiccup. Every caller that wants to say which one it was calls this rather than matching the prose itself, so the wording can only be got wrong in one place, and that place has a test.

string

The error from a { ok: false } AskStructuredResult.

number

The budget passed to that same askStructured call — the timeout text carries it, so a different value here reports a genuine timeout as call-failed.

StructuredFailureKind