internal: improve error handling

Signed-off-by: Jens Langhammer <jens@goauthentik.io>
This commit is contained in:
Jens Langhammer 2023-01-08 20:35:25 +01:00
parent a9680d6088
commit 98876df5c5
No known key found for this signature in database
1 changed files with 6 additions and 2 deletions

View File

@ -24,12 +24,16 @@ func EnableDebugServer() {
h.HandleFunc("/debug/pprof/symbol", pprof.Symbol) h.HandleFunc("/debug/pprof/symbol", pprof.Symbol)
h.HandleFunc("/debug/pprof/trace", pprof.Trace) h.HandleFunc("/debug/pprof/trace", pprof.Trace)
h.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { 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() tpl, err := route.GetPathTemplate()
if err != nil { if err != nil {
return nil return nil
} }
w.Write([]byte(fmt.Sprintf("<a href='%[1]s'>%[1]s</a><br>", tpl))) _, err = w.Write([]byte(fmt.Sprintf("<a href='%[1]s'>%[1]s</a><br>", tpl)))
if err != nil {
l.WithError(err).Warning("failed to write index")
return nil
}
return nil return nil
}) })
}) })