Fix noisy errors (#49)

* send message error.

* read message error.

* close webrtc conn only if not closed yet.

* file upload no files received.
This commit is contained in:
Miroslav Šedivý 2023-05-19 17:19:38 +02:00 committed by GitHub
parent 3e8d686c0f
commit dfc7eb3882
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 26 additions and 12 deletions

View file

@ -2,6 +2,7 @@ package websocket
import (
"encoding/json"
"errors"
"sync"
"github.com/gorilla/websocket"
@ -42,7 +43,8 @@ func (peer *WebSocketPeerCtx) Send(event string, payload any) {
})
if err != nil {
peer.logger.Err(err).Str("event", event).Msg("send message error")
err = errors.Unwrap(err) // unwrap if possible
peer.logger.Warn().Err(err).Str("event", event).Msg("send message error")
return
}