f-21: debug: use err correct returne for kv db

Signed-off-by: GnomeZworc <nicolas.boufidjeline@g3e.fr>
This commit is contained in:
GnomeZworc 2026-04-26 14:52:14 +02:00
commit 6b104c4784
Signed by: nicolas.boufideline
GPG key ID: 4406BBBF8845D632
5 changed files with 25 additions and 7 deletions

View file

@ -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})
}