Repository navigation
Expand file tree
/
Copy patherrors.go
More file actions
77 lines (61 loc) · 2.94 KB
/
Copy patherrors.go
File metadata and controls
77 lines (61 loc) · 2.94 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
package nexus
import (
"errors"
"github.com/xraph/nexus/pipeline/middlewares"
"github.com/xraph/nexus/provider"
)
// ErrNotInitialized is returned by the engine's calls before
// [Gateway.Initialize] has finished.
var ErrNotInitialized = errors.New("nexus: gateway not initialized")
var (
// Provider errors
ErrProviderNotFound = errors.New("nexus: provider not found")
ErrProviderUnavailable = errors.New("nexus: provider unavailable")
ErrModelNotSupported = errors.New("nexus: model not supported by provider")
ErrAllProvidersFailed = errors.New("nexus: all providers failed")
// Auth errors
ErrUnauthorized = errors.New("nexus: unauthorized")
ErrAPIKeyInvalid = errors.New("nexus: invalid API key")
ErrAPIKeyRevoked = errors.New("nexus: API key revoked")
// Tenant errors
ErrTenantNotFound = errors.New("nexus: tenant not found")
ErrTenantDisabled = errors.New("nexus: tenant disabled")
ErrQuotaExceeded = errors.New("nexus: quota exceeded")
ErrBudgetExceeded = errors.New("nexus: budget exceeded")
// Rate limiting
ErrRateLimited = errors.New("nexus: rate limited")
// Guardrail errors
ErrContentBlocked = errors.New("nexus: content blocked by guardrail")
ErrPIIDetected = errors.New("nexus: PII detected in request")
ErrInjectionDetected = errors.New("nexus: prompt injection detected")
// Cache errors
ErrCacheNotConfigured = errors.New("nexus: cache not configured")
// Pipeline errors
ErrPipelineAborted = errors.New("nexus: pipeline aborted")
ErrCircuitOpen = errors.New("nexus: circuit breaker open")
// Context & tokens
ErrContextOverflow = errors.New("nexus: request exceeds context window")
ErrTokenEstimateFailed = errors.New("nexus: token estimation failed")
// Model aliases
ErrAliasNotFound = errors.New("nexus: model alias not found")
ErrNoTargetsAvailable = errors.New("nexus: no alias targets available")
// Extended thinking
ErrThinkingNotSupported = errors.New("nexus: provider does not support extended thinking")
// Batch
ErrBatchTooLarge = errors.New("nexus: batch exceeds maximum size")
ErrBatchNotFound = errors.New("nexus: batch job not found")
// ErrModelUnpriced refuses a request for a model with no price at the
// provider it was routed to (RefuseUnpriced). It is a *RefusalError with
// code model_unpriced and status 400.
ErrModelUnpriced = middlewares.ErrModelUnpriced
// Credentials
ErrCredentialExpired = errors.New("nexus: provider credential expired")
// ErrCredentialNotFound is provider.ErrCredentialNotFound: a credential
// provider returns it to serve a request with the provider's own key.
ErrCredentialNotFound = provider.ErrCredentialNotFound
// ErrCredentialUnavailable refuses a request whose credential could not
// be resolved, or that the chosen provider cannot use
// (WithCredentialProvider). It is a *RefusalError with code unavailable
// and status 503; nothing is sent to the provider.
ErrCredentialUnavailable = middlewares.ErrCredentialUnavailable
)