|
|
@@ -14,6 +14,9 @@
|
|
|
limitations under the License.
|
|
|
*/
|
|
|
|
|
|
+// error package describes errors in etcd project.
|
|
|
+// When any change happens, Documentation/errorcode.md needs to be updated
|
|
|
+// correspondingly.
|
|
|
package error
|
|
|
|
|
|
import (
|
|
|
@@ -27,24 +30,24 @@ var errors = map[int]string{
|
|
|
EcodeKeyNotFound: "Key not found",
|
|
|
EcodeTestFailed: "Compare failed", //test and set
|
|
|
EcodeNotFile: "Not a file",
|
|
|
- EcodeNoMorePeer: "Reached the max number of peers in the cluster",
|
|
|
+ ecodeNoMorePeer: "Reached the max number of peers in the cluster",
|
|
|
EcodeNotDir: "Not a directory",
|
|
|
EcodeNodeExist: "Key already exists", // create
|
|
|
+ ecodeKeyIsPreserved: "The prefix of given key is a keyword in etcd",
|
|
|
EcodeRootROnly: "Root is read only",
|
|
|
- EcodeKeyIsPreserved: "The prefix of given key is a keyword in etcd",
|
|
|
EcodeDirNotEmpty: "Directory not empty",
|
|
|
- EcodeExistingPeerAddr: "Peer address has existed",
|
|
|
+ ecodeExistingPeerAddr: "Peer address has existed",
|
|
|
|
|
|
// Post form related errors
|
|
|
- EcodeValueRequired: "Value is Required in POST form",
|
|
|
+ ecodeValueRequired: "Value is Required in POST form",
|
|
|
EcodePrevValueRequired: "PrevValue is Required in POST form",
|
|
|
EcodeTTLNaN: "The given TTL in POST form is not a number",
|
|
|
EcodeIndexNaN: "The given index in POST form is not a number",
|
|
|
- EcodeValueOrTTLRequired: "Value or TTL is required in POST form",
|
|
|
- EcodeTimeoutNaN: "The given timeout in POST form is not a number",
|
|
|
- EcodeNameRequired: "Name is required in POST form",
|
|
|
- EcodeIndexOrValueRequired: "Index or value is required",
|
|
|
- EcodeIndexValueMutex: "Index and value cannot both be specified",
|
|
|
+ ecodeValueOrTTLRequired: "Value or TTL is required in POST form",
|
|
|
+ ecodeTimeoutNaN: "The given timeout in POST form is not a number",
|
|
|
+ ecodeNameRequired: "Name is required in POST form",
|
|
|
+ ecodeIndexOrValueRequired: "Index or value is required",
|
|
|
+ ecodeIndexValueMutex: "Index and value cannot both be specified",
|
|
|
EcodeInvalidField: "Invalid field",
|
|
|
EcodeInvalidForm: "Invalid POST form",
|
|
|
|
|
|
@@ -55,12 +58,12 @@ var errors = map[int]string{
|
|
|
// etcd related errors
|
|
|
EcodeWatcherCleared: "watcher is cleared due to etcd recovery",
|
|
|
EcodeEventIndexCleared: "The event in requested index is outdated and cleared",
|
|
|
- EcodeStandbyInternal: "Standby Internal Error",
|
|
|
- EcodeInvalidActiveSize: "Invalid active size",
|
|
|
- EcodeInvalidRemoveDelay: "Standby remove delay",
|
|
|
+ ecodeStandbyInternal: "Standby Internal Error",
|
|
|
+ ecodeInvalidActiveSize: "Invalid active size",
|
|
|
+ ecodeInvalidRemoveDelay: "Standby remove delay",
|
|
|
|
|
|
// client related errors
|
|
|
- EcodeClientInternal: "Client Internal Error",
|
|
|
+ ecodeClientInternal: "Client Internal Error",
|
|
|
}
|
|
|
|
|
|
var errorStatus = map[int]int{
|
|
|
@@ -77,23 +80,23 @@ const (
|
|
|
EcodeKeyNotFound = 100
|
|
|
EcodeTestFailed = 101
|
|
|
EcodeNotFile = 102
|
|
|
- EcodeNoMorePeer = 103
|
|
|
+ ecodeNoMorePeer = 103
|
|
|
EcodeNotDir = 104
|
|
|
EcodeNodeExist = 105
|
|
|
- EcodeKeyIsPreserved = 106
|
|
|
+ ecodeKeyIsPreserved = 106
|
|
|
EcodeRootROnly = 107
|
|
|
EcodeDirNotEmpty = 108
|
|
|
- EcodeExistingPeerAddr = 109
|
|
|
+ ecodeExistingPeerAddr = 109
|
|
|
|
|
|
- EcodeValueRequired = 200
|
|
|
+ ecodeValueRequired = 200
|
|
|
EcodePrevValueRequired = 201
|
|
|
EcodeTTLNaN = 202
|
|
|
EcodeIndexNaN = 203
|
|
|
- EcodeValueOrTTLRequired = 204
|
|
|
- EcodeTimeoutNaN = 205
|
|
|
- EcodeNameRequired = 206
|
|
|
- EcodeIndexOrValueRequired = 207
|
|
|
- EcodeIndexValueMutex = 208
|
|
|
+ ecodeValueOrTTLRequired = 204
|
|
|
+ ecodeTimeoutNaN = 205
|
|
|
+ ecodeNameRequired = 206
|
|
|
+ ecodeIndexOrValueRequired = 207
|
|
|
+ ecodeIndexValueMutex = 208
|
|
|
EcodeInvalidField = 209
|
|
|
EcodeInvalidForm = 210
|
|
|
|
|
|
@@ -102,11 +105,11 @@ const (
|
|
|
|
|
|
EcodeWatcherCleared = 400
|
|
|
EcodeEventIndexCleared = 401
|
|
|
- EcodeStandbyInternal = 402
|
|
|
- EcodeInvalidActiveSize = 403
|
|
|
- EcodeInvalidRemoveDelay = 404
|
|
|
+ ecodeStandbyInternal = 402
|
|
|
+ ecodeInvalidActiveSize = 403
|
|
|
+ ecodeInvalidRemoveDelay = 404
|
|
|
|
|
|
- EcodeClientInternal = 500
|
|
|
+ ecodeClientInternal = 500
|
|
|
)
|
|
|
|
|
|
type Error struct {
|