[#1509] morph: Log WS client closing error

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
This commit is contained in:
Pavel Karpy 2022-06-09 22:22:02 +03:00 committed by LeL
parent 1708cc0cc7
commit 8c77387982

View file

@ -112,7 +112,16 @@ func (c *Client) notificationLoop() {
// state: if it is closed, the connection is // state: if it is closed, the connection is
// considered to be lost // considered to be lost
if !ok { 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() { if !c.switchRPC() {
c.logger.Error("could not establish connection to any RPC node") c.logger.Error("could not establish connection to any RPC node")