|
@@ -34,6 +34,7 @@ const (
|
|
|
EcodeKeyIsPreserved = 106
|
|
EcodeKeyIsPreserved = 106
|
|
|
EcodeRootROnly = 107
|
|
EcodeRootROnly = 107
|
|
|
EcodeDirNotEmpty = 108
|
|
EcodeDirNotEmpty = 108
|
|
|
|
|
+ EcodeNoValueOnDir = 109
|
|
|
|
|
|
|
|
EcodeValueRequired = 200
|
|
EcodeValueRequired = 200
|
|
|
EcodePrevValueRequired = 201
|
|
EcodePrevValueRequired = 201
|
|
@@ -66,6 +67,7 @@ func init() {
|
|
|
errors[EcodeRootROnly] = "Root is read only"
|
|
errors[EcodeRootROnly] = "Root is read only"
|
|
|
errors[EcodeKeyIsPreserved] = "The prefix of given key is a keyword in etcd"
|
|
errors[EcodeKeyIsPreserved] = "The prefix of given key is a keyword in etcd"
|
|
|
errors[EcodeDirNotEmpty] = "Directory not empty"
|
|
errors[EcodeDirNotEmpty] = "Directory not empty"
|
|
|
|
|
+ errors[EcodeNoValueOnDir] = "Cannot set value on directory"
|
|
|
|
|
|
|
|
// Post form related errors
|
|
// Post form related errors
|
|
|
errors[EcodeValueRequired] = "Value is Required in POST form"
|
|
errors[EcodeValueRequired] = "Value is Required in POST form"
|
|
@@ -126,7 +128,7 @@ func (e Error) Write(w http.ResponseWriter) {
|
|
|
switch e.ErrorCode {
|
|
switch e.ErrorCode {
|
|
|
case EcodeKeyNotFound:
|
|
case EcodeKeyNotFound:
|
|
|
status = http.StatusNotFound
|
|
status = http.StatusNotFound
|
|
|
- case EcodeNotFile, EcodeDirNotEmpty:
|
|
|
|
|
|
|
+ case EcodeNotFile, EcodeDirNotEmpty, EcodeNoValueOnDir:
|
|
|
status = http.StatusForbidden
|
|
status = http.StatusForbidden
|
|
|
case EcodeTestFailed, EcodeNodeExist:
|
|
case EcodeTestFailed, EcodeNodeExist:
|
|
|
status = http.StatusPreconditionFailed
|
|
status = http.StatusPreconditionFailed
|