don't try to http.Error after trying to encode to w

This commit is contained in:
Fran Bull 2025-02-27 10:18:30 -08:00
parent af2fd8bd7e
commit 4175e2e21d
2 changed files with 1 additions and 3 deletions

View File

@ -165,7 +165,7 @@ func (c *Consensus) makeCommandMux() *http.ServeMux {
return return
} }
if err := json.NewEncoder(w).Encode(result); err != nil { if err := json.NewEncoder(w).Encode(result); err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError) log.Printf("error encoding execute command result: %v", err)
return return
} }
}) })

View File

@ -69,7 +69,6 @@ func (m *monitor) handleFullStatus(w http.ResponseWriter, r *http.Request) {
} }
if err := json.NewEncoder(w).Encode(s); err != nil { if err := json.NewEncoder(w).Encode(s); err != nil {
log.Printf("monitor: error encoding full status: %v", err) log.Printf("monitor: error encoding full status: %v", err)
http.Error(w, "", http.StatusInternalServerError)
return return
} }
} }
@ -121,7 +120,6 @@ func (m *monitor) handleNetmap(w http.ResponseWriter, r *http.Request) {
encoder.SetIndent("", "\t") encoder.SetIndent("", "\t")
if err := encoder.Encode(n); err != nil { if err := encoder.Encode(n); err != nil {
log.Printf("monitor: error encoding netmap: %v", err) log.Printf("monitor: error encoding netmap: %v", err)
http.Error(w, "", http.StatusInternalServerError)
return return
} }
} }