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,12 +405,21 @@ 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):
|
||||
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")
|
||||
}
|
||||
return // All errors need to quit this function
|
||||
|
||||
case msg := <-sendMsgC:
|
||||
|
|
Loading…
Reference in a new issue