Browse Source

fix wrong error

Xiang Li 12 years ago
parent
commit
8f551e3dc1
2 changed files with 2 additions and 1 deletions
  1. 1 1
      client_handlers.go
  2. 1 0
      error.go

+ 1 - 1
client_handlers.go

@@ -131,7 +131,7 @@ func dispatch(c Command, w *http.ResponseWriter, req *http.Request, client bool)
 
 
 			if body == nil {
 			if body == nil {
 				(*w).WriteHeader(http.StatusNotFound)
 				(*w).WriteHeader(http.StatusNotFound)
-				(*w).Write(newJsonError(100, ""))
+				(*w).Write(newJsonError(300, "Empty result from raft"))
 			} else {
 			} else {
 				body, ok := body.([]byte)
 				body, ok := body.([]byte)
 				// this should not happen
 				// this should not happen

+ 1 - 0
error.go

@@ -20,6 +20,7 @@ func init() {
 	errors[201] = "PrevValue is Required in POST form"
 	errors[201] = "PrevValue is Required in POST form"
 	errors[202] = "The given TTL in POST form is not a number"
 	errors[202] = "The given TTL in POST form is not a number"
 	errors[203] = "The given index in POST form is not a number"
 	errors[203] = "The given index in POST form is not a number"
+	
 	// raft related errors
 	// raft related errors
 	errors[300] = "Raft Internal Error"
 	errors[300] = "Raft Internal Error"
 	errors[301] = "During Leader Election"
 	errors[301] = "During Leader Election"