Documentation
¶
Overview ¶
Package errhint classifies provider/model failures into a few user-actionable categories and turns them into a one-line "next step" hint.
Provider errors already arrive with a classified string prefix from providerio.ClassifiedError ("auth error:", "rate limit error:", …); lower-level failures (DNS, TLS, timeouts, context-length) arrive as raw driver or library messages. Classify matches both so the interactive error row (TUI) and the `zero exec` provider-error path (CLI) can append one concrete next step instead of dumping an identical red blob for every failure mode.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CLIHint ¶
CLIHint returns a one-line hint referencing `zero …` subcommands, or "" when the category is Unknown. Meant for the non-interactive `zero exec` error path, where slash commands don't apply.
func HasStatusCode ¶
HasStatusCode reports whether haystack contains any of the given HTTP status codes as a standalone number — not embedded in a longer digit run like "completed in 4290ms" or "request id 14015". Exported so other packages (e.g. the reconnect classifier) can gate on a status code without re-implementing the digit-boundary check.
Types ¶
type Category ¶
type Category int
Category buckets a provider/model failure into a small set of classes that each map to a distinct recovery action.
func Classify ¶
Classify buckets err by scanning its message for known signatures. It is a deliberately conservative string heuristic — the provider layer has already discarded the numeric HTTP status by the time the error reaches a UI surface, so the message is all we have. It first gates on a provider-origin marker (see providerMarkers) so local failures never draw a provider hint, then sub-classifies. Order matters: more specific signatures are tested before broader ones (e.g. "context length" as overflow before the generic "timeout" as connectivity).