persona-community-2/pkg/routing/errors.go
jordan cb3d4d5786
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
ci/woodpecker/manual/woodpecker Pipeline was successful
Initialize project from skeleton template
2026-02-23 10:53:55 +00:00

36 lines
1.4 KiB
Go

package routing
import "errors"
// Sentinel errors for programmatic handling with errors.Is().
//
// Provider implementations should wrap these errors to enable proper
// error classification and cooldown behavior:
//
// return fmt.Errorf("gemini API error: %w", routing.ErrRateLimit)
var (
// ErrRateLimit indicates provider returned a rate limit (429) error.
// Triggers long cooldown (DefaultCooldownPeriod, typically 1 hour).
ErrRateLimit = errors.New("routing: rate limit exceeded")
// ErrQuotaExceeded indicates provider's quota has been exhausted.
// Triggers long cooldown (DefaultCooldownPeriod, typically 1 hour).
ErrQuotaExceeded = errors.New("routing: quota exceeded")
// ErrServerUnavailable indicates a transient server error (5xx).
// Triggers short cooldown (TransientCooldownPeriod, typically 30 seconds).
ErrServerUnavailable = errors.New("routing: server unavailable")
// ErrAllProvidersFailed indicates all providers (including terminus) failed.
// This error means the request could not be completed despite trying
// all available providers.
ErrAllProvidersFailed = errors.New("routing: all providers failed")
// ErrNoProviders indicates no providers were configured.
// This is a configuration error that should be caught at startup.
ErrNoProviders = errors.New("routing: no providers configured")
// ErrInvalidConfig indicates invalid routing configuration.
ErrInvalidConfig = errors.New("routing: invalid configuration")
)