mirror of
https://github.com/Luzifer/twitch-bot.git
synced 2024-12-20 11:51:17 +00:00
[overlays] Fix: Do not spam logs with errors when overlay reloaded
Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
parent
eb02858280
commit
fa9f5591f6
1 changed files with 11 additions and 3 deletions
|
@ -315,10 +315,18 @@ func handleSocketSubscription(w http.ResponseWriter, r *http.Request) {
|
|||
return
|
||||
|
||||
case err := <-errC:
|
||||
if err != nil {
|
||||
logger.WithError(err).Error("Message processing caused error")
|
||||
var cErr *websocket.CloseError
|
||||
switch {
|
||||
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
|
||||
|
||||
default:
|
||||
logger.WithError(err).Error("message processing caused error")
|
||||
}
|
||||
return // We use nil-error to close the connection
|
||||
return // All errors need to quit this function
|
||||
|
||||
case msg := <-sendMsgC:
|
||||
if !isAuthorized {
|
||||
|
|
Loading…
Reference in a new issue