*: key handler should write auth error as etcd error

This commit is contained in:
Xiang Li
2015-08-17 13:30:39 -07:00
parent f615f9a999
commit 87f061bab2
3 changed files with 17 additions and 8 deletions

View File

@@ -35,6 +35,7 @@ var errors = map[int]string{
EcodeRootROnly: "Root is read only",
EcodeDirNotEmpty: "Directory not empty",
ecodeExistingPeerAddr: "Peer address has existed",
EcodeUnauthorized: "The request requires user authentication",
// Post form related errors
ecodeValueRequired: "Value is Required in POST form",
@@ -68,6 +69,7 @@ var errorStatus = map[int]int{
EcodeKeyNotFound: http.StatusNotFound,
EcodeNotFile: http.StatusForbidden,
EcodeDirNotEmpty: http.StatusForbidden,
EcodeUnauthorized: http.StatusUnauthorized,
EcodeTestFailed: http.StatusPreconditionFailed,
EcodeNodeExist: http.StatusPreconditionFailed,
EcodeRaftInternal: http.StatusInternalServerError,
@@ -85,6 +87,7 @@ const (
EcodeRootROnly = 107
EcodeDirNotEmpty = 108
ecodeExistingPeerAddr = 109
EcodeUnauthorized = 110
ecodeValueRequired = 200
EcodePrevValueRequired = 201