-
Notifications
You must be signed in to change notification settings - Fork 4
/
errors.go
163 lines (155 loc) · 10.3 KB
/
errors.go
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
package tarantool
import (
"fmt"
)
// Error is wrapper around error returned by Tarantool.
type Error struct {
Code uint32
Msg string
}
func (err Error) Error() string {
return fmt.Sprintf("%s (0x%x)", err.Msg, err.Code)
}
// ClientError is connection produced by this client – i.e. connection failures or timeouts.
type ClientError struct {
Code uint32
Msg string
}
func (err ClientError) Error() string {
return fmt.Sprintf("%s (0x%x)", err.Msg, err.Code)
}
// Temporary returns true if next attempt to perform request may succeed.
// Currently, it returns true when:
// - Connection is not connected at the moment,
// - or request is timed out,
// - or request is aborted due to rate limit.
func (err ClientError) Temporary() bool {
switch err.Code {
case ErrConnectionNotReady, ErrTimedOut, ErrRateLimited:
return true
default:
return false
}
}
// Tarantool client error codes.
const (
ErrConnectionNotReady = 0x4000 + iota
ErrConnectionClosed = 0x4000 + iota
ErrProtocolError = 0x4000 + iota
ErrTimedOut = 0x4000 + iota
ErrRateLimited = 0x4000 + iota
)
// Tarantool server error codes.
const (
ErrUnknown = 0 // Unknown error
ErrIllegalParams = 1 // Illegal parameters, %s
ErrMemoryIssue = 2 // Failed to allocate %u bytes in %s for %s
ErrTupleFound = 3 // Duplicate key exists in unique index '%s' in space '%s'
ErrTupleNotFound = 4 // Tuple doesn't exist in index '%s' in space '%s'
ErrUnsupported = 5 // %s does not support %s
ErrNonMaster = 6 // Can't modify data on a replication slave. My master is: %s
ErrReadonly = 7 // Can't modify data because this server is in read-only mode.
ErrInjection = 8 // Error injection '%s'
ErrCreateSpace = 9 // Failed to create space '%s': %s
ErrSpaceExists = 10 // Space '%s' already exists
ErrDropSpace = 11 // Can't drop space '%s': %s
ErrAlterSpace = 12 // Can't modify space '%s': %s
ErrIndexType = 13 // Unsupported index type supplied for index '%s' in space '%s'
ErrModifyIndex = 14 // Can't create or modify index '%s' in space '%s': %s
ErrLastDrop = 15 // Can't drop the primary key in a system space, space '%s'
ErrTupleFormatLimit = 16 // Tuple format limit reached: %u
ErrDropPrimaryKey = 17 // Can't drop primary key in space '%s' while secondary keys exist
ErrKeyPartType = 18 // Supplied key type of part %u does not match index part type: expected %s
ErrExactMatch = 19 // Invalid key part count in an exact match (expected %u, got %u)
ErrInvalidMsgpack = 20 // Invalid MsgPack - %s
ErrProcRet = 21 // msgpack.encode: can not encode Lua type '%s'
ErrTupleNotArray = 22 // Tuple/Key must be MsgPack array
ErrFieldType = 23 // Tuple field %u type does not match one required by operation: expected %s
ErrFieldTypeMismatch = 24 // Ambiguous field type in index '%s', key part %u. Requested type is %s but the field has previously been defined as %s
ErrSplice = 25 // SPLICE error on field %u: %s
ErrArgType = 26 // Argument type in operation '%c' on field %u does not match field type: expected a %s
ErrTupleIsTooLong = 27 // Tuple is too long %u
ErrUnknownUpdateOp = 28 // Unknown UPDATE operation
ErrUpdateField = 29 // Field %u UPDATE error: %s
ErrFiberStack = 30 // Can not create a new fiber: recursion limit reached
ErrKeyPartCount = 31 // Invalid key part count (expected [0..%u], got %u)
ErrProcLua = 32 // %s
ErrNoSuchProc = 33 // Procedure '%.*s' is not defined
ErrNoSuchTrigger = 34 // Trigger is not found
ErrNoSuchIndex = 35 // No index #%u is defined in space '%s'
ErrNoSuchSpace = 36 // Space '%s' does not exist
ErrNoSuchField = 37 // Field %d was not found in the tuple
ErrSpaceFieldCount = 38 // Tuple field count %u does not match space '%s' field count %u
ErrIndexFieldCount = 39 // Tuple field count %u is less than required by a defined index (expected %u)
ErrWalIO = 40 // Failed to write to disk
ErrMoreThanOneTuple = 41 // More than one tuple found by GetContext()
ErrAccessDenied = 42 // %s access denied for user '%s'
ErrCreateUser = 43 // Failed to create user '%s': %s
ErrDropUser = 44 // Failed to drop user '%s': %s
ErrNoSuchUser = 45 // User '%s' is not found
ErrUserExists = 46 // User '%s' already exists
ErrPasswordMismatch = 47 // Incorrect password supplied for user '%s'
ErrUnknownRequestType = 48 // Unknown request type %u
ErrUnknownSchemaObject = 49 // Unknown object type '%s'
ErrCreateFunction = 50 // Failed to create function '%s': %s
ErrNoSuchFunction = 51 // Function '%s' does not exist
ErrFunctionExists = 52 // Function '%s' already exists
ErrFunctionAccessDenied = 53 // %s access denied for user '%s' to function '%s'
ErrFunctionMax = 54 // A limit on the total number of functions has been reached: %u
ErrSpaceAccessDenied = 55 // %s access denied for user '%s' to space '%s'
ErrUserMax = 56 // A limit on the total number of users has been reached: %u
ErrNoSuchEngine = 57 // Space engine '%s' does not exist
ErrReloadCfg = 58 // Can't set option '%s' dynamically
ErrCfg = 59 // Incorrect value for option '%s': %s
ErrSophia = 60 // %s
ErrLocalServerIsNotActive = 61 // Local server is not active
ErrUnknownServer = 62 // Server %s is not registered with the cluster
ErrClusterIdMismatch = 63 // Cluster id of the replica %s doesn't match cluster id of the master %s
ErrInvalidUUID = 64 // Invalid UUID: %s
ErrClusterIdIsRo = 65 // Can't reset cluster id: it is already assigned
ErrReserved66 = 66 // Reserved66
ErrServerIdIsReserved = 67 // Can't initialize server id with a reserved value %u
ErrInvalidOrder = 68 // Invalid LSN order for server %u: previous LSN = %llu, new lsn = %llu
ErrMissingRequestField = 69 // Missing mandatory field '%s' in request
ErrIdentifier = 70 // Invalid identifier '%s' (expected letters, digits or an underscore)
ErrDropFunction = 71 // Can't drop function %u: %s
ErrIteratorType = 72 // Unknown iterator type '%s'
ErrReplicaMax = 73 // Replica count limit reached: %u
ErrInvalidXlog = 74 // Failed to read xlog: %lld
ErrInvalidXlogName = 75 // Invalid xlog name: expected %lld got %lld
ErrInvalidXlogOrder = 76 // Invalid xlog order: %lld and %lld
ErrNoConnection = 77 // Connection is not established
ErrTimeout = 78 // Timeout exceeded
ErrActiveTransaction = 79 // Operation is not permitted when there is an active transaction
ErrNoActiveTransaction = 80 // Operation is not permitted when there is no active transaction
ErrCrossEngineTransaction = 81 // A multi-statement transaction can not use multiple storage engines
ErrNoSuchRole = 82 // Role '%s' is not found
ErrRoleExists = 83 // Role '%s' already exists
ErrCreateRole = 84 // Failed to create role '%s': %s
ErrIndexExists = 85 // Index '%s' already exists
ErrTupleRefOverflow = 86 // Tuple reference counter overflow
ErrRoleLoop = 87 // Granting role '%s' to role '%s' would create a loop
ErrGrant = 88 // Incorrect grant arguments: %s
ErrPrivilegeGranted = 89 // User '%s' already has %s access on %s '%s'
ErrRoleGranted = 90 // User '%s' already has role '%s'
ErrPrivilegeNotGranted = 91 // User '%s' does not have %s access on %s '%s'
ErrRoleNotGranted = 92 // User '%s' does not have role '%s'
ErrMissingSnapshot = 93 // Can't find snapshot
ErrCantUpdatePrimaryKey = 94 // Attempt to modify a tuple field which is part of index '%s' in space '%s'
ErrUpdateIntegerOverflow = 95 // Integer overflow when performing '%c' operation on field %u
ErrGuestUserPassword = 96 // Setting password for guest user has no effect
ErrTransactionConflict = 97 // Transaction has been aborted by conflict
ErrUnsupportedRolePrivilege = 98 // Unsupported role privilege '%s'
ErrLoadFunction = 99 // Failed to dynamically load function '%s': %s
ErrFunctionLanguage = 100 // Unsupported language '%s' specified for function '%s'
ErrRtreeRect = 101 // RTree: %s must be an array with %u (point) or %u (rectangle/box) numeric coordinates
ErrProcC = 102 // ???
ErrUnknownRtreeIndexDistanceType = 103 // Unknown RTREE index distance type %s
ErrProtocol = 104 // %s
ErrUpsertUniqueSecondaryKey = 105 // Space %s has a unique secondary index and does not support UPSERT
ErrWrongIndexRecord = 106 // Wrong record in _index space: got {%s}, expected {%s}
ErrWrongIndexParts = 107 // Wrong index parts (field %u): %s; expected field1 id (number), field1 type (string), ...
ErrWrongIndexOptions = 108 // Wrong index options (field %u): %s
ErrWrongSchemaVersion = 109 // Wrong schema version, current: %d, in request: %u
ErrSlabAllocMax = 110 // Failed to allocate %u bytes for tuple in the slab allocator: tuple is too large. Check 'slab_alloc_maximal' configuration option.
)