Skip to content

Commit

Permalink
web, also hide error messages when disconnecting mid stream
Browse files Browse the repository at this point in the history
* This can happen on normal connections as well, not only on websockets
  • Loading branch information
BuJo committed Jul 1, 2024
1 parent 0accd28 commit 07f82d2
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pkg/web/web.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,11 @@ func (h *webHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
if err := recover(); err != nil {
switch err := err.(type) {
case error:
slog.ErrorContext(r.Context(), "panic serving", slog.Any("error", err))
if errors.Is(err, DisconnectError) {
slog.DebugContext(r.Context(), "panic serving", slog.Any("error", err))
} else {
slog.InfoContext(r.Context(), "panic serving", slog.Any("error", err))
}
default:
slog.ErrorContext(r.Context(), "panic serving", slog.Any("error", err))
}
Expand Down

0 comments on commit 07f82d2

Please sign in to comment.