36 lines
1.4 KiB
Go
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")
|
|
)
|