From 98876df5c57d068bcae81ed634f60a9193150546 Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Sun, 8 Jan 2023 20:35:25 +0100 Subject: [PATCH] internal: improve error handling Signed-off-by: Jens Langhammer --- internal/debug/debug.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/internal/debug/debug.go b/internal/debug/debug.go index 4a8140452..eefb68c84 100644 --- a/internal/debug/debug.go +++ b/internal/debug/debug.go @@ -24,12 +24,16 @@ func EnableDebugServer() { h.HandleFunc("/debug/pprof/symbol", pprof.Symbol) h.HandleFunc("/debug/pprof/trace", pprof.Trace) h.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { - h.Walk(func(route *mux.Route, router *mux.Router, ancestors []*mux.Route) error { + _ = h.Walk(func(route *mux.Route, router *mux.Router, ancestors []*mux.Route) error { tpl, err := route.GetPathTemplate() if err != nil { return nil } - w.Write([]byte(fmt.Sprintf("%[1]s
", tpl))) + _, err = w.Write([]byte(fmt.Sprintf("%[1]s
", tpl))) + if err != nil { + l.WithError(err).Warning("failed to write index") + return nil + } return nil }) })