mirror of
https://github.com/Luzifer/twitch-bot.git
synced 2024-12-20 20:01:17 +00:00
[overlays] Reduce socket abnormal closure to warning
resolves TWITCH-BOT-A Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
parent
c3085ea7f9
commit
46db72b2cc
1 changed files with 11 additions and 2 deletions
|
@ -405,8 +405,17 @@ func handleSocketSubscription(w http.ResponseWriter, r *http.Request) {
|
||||||
case err == nil:
|
case err == nil:
|
||||||
// We use nil-error to close the connection
|
// We use nil-error to close the connection
|
||||||
|
|
||||||
case errors.As(err, &cErr) && websocket.IsCloseError(cErr, websocket.CloseNormalClosure, websocket.CloseGoingAway):
|
case errors.As(err, &cErr):
|
||||||
// We don't need to log when the remote closes the websocket gracefully
|
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:
|
default:
|
||||||
logger.WithError(err).Error("message processing caused error")
|
logger.WithError(err).Error("message processing caused error")
|
||||||
|
|
Loading…
Reference in a new issue