From 8c77387982738ab395e8130ff8066ef1202435f2 Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Thu, 9 Jun 2022 22:22:02 +0300 Subject: [PATCH] [#1509] morph: Log WS client closing error Signed-off-by: Pavel Karpy --- pkg/morph/client/multi.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/pkg/morph/client/multi.go b/pkg/morph/client/multi.go index a6eb35e6..053967dc 100644 --- a/pkg/morph/client/multi.go +++ b/pkg/morph/client/multi.go @@ -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")