[overlays] Reduce socket abnormal closure to warning

resolves TWITCH-BOT-A

Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
Knut Ahlers 2024-03-23 12:16:10 +01:00
parent c3085ea7f9
commit 46db72b2cc
Signed by: luzifer
SSH key fingerprint: SHA256:/xtE5lCgiRDQr8SLxHMS92ZBlACmATUmF1crK16Ks4E

View file

@ -405,8 +405,17 @@ func handleSocketSubscription(w http.ResponseWriter, r *http.Request) {
case err == nil:
// We use nil-error to close the connection
case errors.As(err, &cErr) && websocket.IsCloseError(cErr, websocket.CloseNormalClosure, websocket.CloseGoingAway):
// We don't need to log when the remote closes the websocket gracefully
case errors.As(err, &cErr):
switch cErr.Code {
case websocket.CloseAbnormalClosure:
logger.WithError(err).Warn("overlay websocket was closed abnormally")
case websocket.CloseNormalClosure, websocket.CloseGoingAway:
// We don't need to log when the remote closes the websocket gracefully
default:
logger.WithError(err).Error("message processing caused error")
}
default:
logger.WithError(err).Error("message processing caused error")