Skip to content

Commit 7e3ffd3

Browse files
committed
Suppress context.Canceled errors in ServerError
1 parent 3fe88f1 commit 7e3ffd3

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

internal/ui/layout/render.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package layout
22

33
import (
4+
"context"
5+
"errors"
46
"log/slog"
57
"net/http"
68

@@ -27,6 +29,9 @@ func Render(w http.ResponseWriter, r *http.Request, page Page, content templ.Com
2729
}
2830

2931
func ServerError(w http.ResponseWriter, msg string, err error) {
32+
if errors.Is(err, context.Canceled) {
33+
return
34+
}
3035
slog.Error(msg, "error", err)
3136
http.Error(w, "internal server error", http.StatusInternalServerError)
3237
}

0 commit comments

Comments
 (0)