From 4175e2e21d85352e270a5fac1b988d71a7bc383a Mon Sep 17 00:00:00 2001 From: Fran Bull Date: Thu, 27 Feb 2025 10:18:30 -0800 Subject: [PATCH] don't try to http.Error after trying to encode to w --- tsconsensus/http.go | 2 +- tsconsensus/monitor.go | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/tsconsensus/http.go b/tsconsensus/http.go index 850778ccd..6501285db 100644 --- a/tsconsensus/http.go +++ b/tsconsensus/http.go @@ -165,7 +165,7 @@ func (c *Consensus) makeCommandMux() *http.ServeMux { return } 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 } }) diff --git a/tsconsensus/monitor.go b/tsconsensus/monitor.go index a71792bb1..0d025b641 100644 --- a/tsconsensus/monitor.go +++ b/tsconsensus/monitor.go @@ -69,7 +69,6 @@ func (m *monitor) handleFullStatus(w http.ResponseWriter, r *http.Request) { } if err := json.NewEncoder(w).Encode(s); err != nil { log.Printf("monitor: error encoding full status: %v", err) - http.Error(w, "", http.StatusInternalServerError) return } } @@ -121,7 +120,6 @@ func (m *monitor) handleNetmap(w http.ResponseWriter, r *http.Request) { encoder.SetIndent("", "\t") if err := encoder.Encode(n); err != nil { log.Printf("monitor: error encoding netmap: %v", err) - http.Error(w, "", http.StatusInternalServerError) return } }