Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions internal/rest/resources/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -415,13 +415,13 @@ func clusterMemberDelete(s state.State, r *http.Request) response.Response {
force := r.URL.Query().Get("force") == "1"
name, err := url.PathUnescape(mux.Vars(r)["name"])
if err != nil {
return response.SmartError(err)
return response.BadRequest(err)
}

allRemotes := s.Remotes().RemotesByName()
remote, ok := allRemotes[name]
if !ok {
return response.SmartError(fmt.Errorf("No remote exists with the given name %q", name))
return response.NotFound(fmt.Errorf("No remote exists with the given name %q", name))
}

ctx, cancel := context.WithTimeout(r.Context(), time.Second*60)
Expand Down Expand Up @@ -533,11 +533,11 @@ func clusterMemberDelete(s state.State, r *http.Request) response.Response {
}

if len(clusterMembers)-numPending < 1 {
return response.SmartError(fmt.Errorf("Cannot remove cluster members, there are no remaining non-pending members"))
return response.BadRequest(fmt.Errorf("Cannot remove cluster members, there are no remaining non-pending members"))
}

if len(info) < 2 {
return response.SmartError(fmt.Errorf("Cannot leave a cluster with %d members", len(info)))
return response.BadRequest(fmt.Errorf("Cannot leave a cluster with %d members", len(info)))
}

// If we are removing the leader of a 2-node cluster, ensure the remaining node is a voter.
Expand Down
Loading