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

@ -47,7 +47,12 @@ func (s *Server) deleteVpc(w http.ResponseWriter, _ *http.Request, name string)
return
}
s.dispatcher.Dispatch(cmd)
state, _ := kv.GetFromDB(s.db, "vpc/"+name+"/state")
state, err := kv.GetFromDB(s.db, "vpc/"+name+"/state")
if err != nil {
w.WriteHeader(http.StatusInternalServerError)
json.NewEncoder(w).Encode(ErrorResponse{Error: "failed to read vpc state"})
return
}
w.WriteHeader(http.StatusAccepted)
json.NewEncoder(w).Encode(VPC{Name: name, State: state})
}