1
0
Fork 0

Better error from /nodes when Store is not open

master
Philip O'Toole 2 years ago
parent 4ab4b08049
commit 9c68b13868

@ -959,8 +959,11 @@ func (s *Service) handleNodes(w http.ResponseWriter, r *http.Request) {
// Get nodes in the cluster, and possibly filter out non-voters.
nodes, err := s.store.Nodes()
if err != nil {
http.Error(w, fmt.Sprintf("store nodes: %s", err.Error()),
http.StatusInternalServerError)
statusCode := http.StatusInternalServerError
if err == store.ErrNotOpen {
statusCode = http.StatusServiceUnavailable
}
http.Error(w, fmt.Sprintf("store nodes: %s", err.Error()), statusCode)
return
}

Loading…
Cancel
Save