@@ -293,19 +293,29 @@ func OperationNotTracked(connID uint64, seqID int64) string {
293293
294294// Connection pool functions
295295func RemovingConnectionFromPool (connID uint64 , reason error ) string {
296- message := fmt .Sprintf ("conn[%d] %s due to: %v" , connID , RemovingConnectionFromPoolMessage , reason )
297- return appendJSONIfDebug (message , map [string ]interface {}{
296+ metadata := map [string ]interface {}{
298297 "connID" : connID ,
299- "reason" : reason .Error (),
300- })
298+ "reason" : "unknown" , // this will be overwritten if reason is not nil
299+ }
300+ if reason != nil {
301+ metadata ["reason" ] = reason .Error ()
302+ }
303+
304+ message := fmt .Sprintf ("conn[%d] %s due to: %v" , connID , RemovingConnectionFromPoolMessage , reason )
305+ return appendJSONIfDebug (message , metadata )
301306}
302307
303308func NoPoolProvidedCannotRemove (connID uint64 , reason error ) string {
304- message := fmt .Sprintf ("conn[%d] %s due to: %v" , connID , NoPoolProvidedMessageCannotRemoveMessage , reason )
305- return appendJSONIfDebug (message , map [string ]interface {}{
309+ metadata := map [string ]interface {}{
306310 "connID" : connID ,
307- "reason" : reason .Error (),
308- })
311+ "reason" : "unknown" , // this will be overwritten if reason is not nil
312+ }
313+ if reason != nil {
314+ metadata ["reason" ] = reason .Error ()
315+ }
316+
317+ message := fmt .Sprintf ("conn[%d] %s due to: %v" , connID , NoPoolProvidedMessageCannotRemoveMessage , reason )
318+ return appendJSONIfDebug (message , metadata )
309319}
310320
311321// Circuit breaker functions
0 commit comments