[#1509] morph: Log WS client closing error

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
remotes/fyrchik/changelog
Pavel Karpy 2022-06-09 22:22:02 +03:00 committed by LeL
parent 1708cc0cc7
commit 8c77387982
1 changed files with 10 additions and 1 deletions

View File

@ -112,7 +112,16 @@ func (c *Client) notificationLoop() {
// state: if it is closed, the connection is
// considered to be lost
if !ok {
c.logger.Warn("switching to the next RPC node")
var closeReason string
if closeErr := c.client.GetError(); closeErr != nil {
closeReason = closeErr.Error()
} else {
closeReason = "unknown"
}
c.logger.Warn("switching to the next RPC node",
zap.String("reason", closeReason),
)
if !c.switchRPC() {
c.logger.Error("could not establish connection to any RPC node")