f-21: debug: use err correct returne for kv db
Signed-off-by: GnomeZworc <nicolas.boufidjeline@g3e.fr>
This commit is contained in:
parent
921a5ca96e
commit
6b104c4784
5 changed files with 25 additions and 7 deletions
|
|
@ -69,7 +69,12 @@ func (s *Server) deleteSubnet(w http.ResponseWriter, _ *http.Request, name strin
|
|||
return
|
||||
}
|
||||
s.dispatcher.Dispatch(cmd)
|
||||
state, _ := kv.GetFromDB(s.db, "subnet/"+name+"/state")
|
||||
state, err := kv.GetFromDB(s.db, "subnet/"+name+"/state")
|
||||
if err != nil {
|
||||
w.WriteHeader(http.StatusInternalServerError)
|
||||
json.NewEncoder(w).Encode(ErrorResponse{Error: "failed to read subnet state"})
|
||||
return
|
||||
}
|
||||
w.WriteHeader(http.StatusAccepted)
|
||||
json.NewEncoder(w).Encode(Subnet{Name: name, State: state})
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue