Documentation
¶
Overview ¶
Package apperr defines the typed error contract shared by the acquisition, CLI, and MCP layers. Agents branch on codes, not on prose strings.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Code ¶
type Code string
Code is a stable machine-readable error code.
const ( CodeInvalidID Code = "invalid_id" CodeBadRequest Code = "bad_request" CodeNotFound Code = "not_found" CodeChannelNotFound Code = "channel_not_found" CodeNotAChannel Code = "not_a_channel" CodePrivate Code = "private" CodeAgeRestricted Code = "age_restricted" CodeBotCheck Code = "bot_check" CodeNoCaptions Code = "no_captions" CodeNoMatchingLang Code = "no_matching_language" CodeRateLimited Code = "rate_limited" CodeBlocked Code = "blocked" CodeNetwork Code = "network" CodeUpstreamChanged Code = "upstream_changed" CodeTimeout Code = "timeout" CodeInternal Code = "internal" )
type Error ¶
type Error struct {
Code Code `json:"code"`
Message string `json:"message"`
Retryable bool `json:"retryable"`
RetryAfterSeconds int `json:"retry_after_seconds,omitempty"`
AvailableLanguages []string `json:"available_languages,omitempty"`
Suggestion string `json:"suggestion,omitempty"`
}
Error is both a Go error and the machine-readable payload returned to agents in structuredContent when IsError is set.
func Aggregate ¶
Aggregate collapses the failure of the ANDROID -> IOS -> watch-page cascade into one typed error an agent can act on, preserving the most specific verdict and any Retry-After hint.
When every attempt failed with the same code the winner is not a synthetic "all methods failed" error: the most specific constituent error (longest message, then a suggestion) is preserved with its suggestion, Retry-After, and available-language list. Mixed-code failures still collapse to upstream_changed, but keep the union of actionable hints.
func ClassifyContext ¶
ClassifyContext turns deadline/cancellation errors into the public contract.
func ClassifyHTTPStatus ¶
ClassifyHTTPStatus maps an upstream HTTP status to the public error contract.
func ClassifyPlayability ¶
ClassifyPlayability maps YouTube's playabilityStatus to the error contract.