mirror of
https://github.com/Luzifer/twitch-bot.git
synced 2025-01-08 20:41:30 +00:00
Compare commits
2 commits
031ad331e4
...
46db72b2cc
Author | SHA1 | Date | |
---|---|---|---|
46db72b2cc | |||
c3085ea7f9 |
2 changed files with 15 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")
|
||||||
|
|
|
@ -385,6 +385,10 @@ func (e *EventSubSocketClient) handleSocketError(err error, msgC chan eventSubSo
|
||||||
e.logger.Debug("websocket was closed normally")
|
e.logger.Debug("websocket was closed normally")
|
||||||
return nil
|
return nil
|
||||||
|
|
||||||
|
case websocket.CloseAbnormalClosure:
|
||||||
|
e.logger.Warn("websocket reported abnormal closure")
|
||||||
|
return errors.Wrap(e.connect(e.socketDest, msgC, errC, "network-error"), "re-connecting after abnormal closure")
|
||||||
|
|
||||||
default:
|
default:
|
||||||
// Some non-twitch close code we did not expect
|
// Some non-twitch close code we did not expect
|
||||||
e.logger.WithError(closeErr).Error("websocket reported unexpected error code")
|
e.logger.WithError(closeErr).Error("websocket reported unexpected error code")
|
||||||
|
|
Loading…
Reference in a new issue