mirror of
https://github.com/rqlite/rqlite.git
synced 2022-10-30 02:37:32 +03:00
Better error from /nodes when Store is not open
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user