Skip to content

describeStructuredFailure

describeStructuredFailure(error, timeoutMs): string

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

Say WHICH of askStructured’s three failures happened, in one sentence a reader can act on.

The two a reader has to tell apart first are a provider that never answered and a provider that refused the request: they want opposite responses — re-run the one, investigate the other — and from the outside they arrive as the same red. Naming the class is what stops a real rejection being shrugged off as flakiness, which is how a guard stops guarding with nobody deciding to remove it.

There is no default arm and no fallback sentence, deliberately. The module-internal STRUCTURED_FAILURE_SENTENCES map, declared above, is typed by the union, so an unhandled kind cannot reach here — the compiler rejects the map instead. A defensive arm would only catch a case the build already refuses, at the price of hiding the compile error that is the real signal. It is named here rather than linked because it is not exported, and a {@link} to an undocumented symbol renders as dead text in the API reference.

string

The error from a { ok: false } AskStructuredResult.

number

The budget passed to that same askStructured call — as for classifyStructuredFailure, a different value here reports a genuine timeout as call-failed.

string