Log exception for association failure (#25438)

There have been cases where the thrown
NettyTransportExceptionNoStackTrace contains no cause
and a message that doesn't indicate what type of exception has been
thrown when establishing a connection.
This commit is contained in:
Christopher Batey 2018-08-06 10:17:58 +01:00 committed by Konrad `ktoso` Malawski
parent 131e6d10d6
commit a0e79a0542

View file

@ -527,7 +527,7 @@ class NettyTransport(val settings: NettyTransportSettings, val system: ExtendedA
else else
readyChannel.getPipeline.get(classOf[ClientHandler]).statusFuture readyChannel.getPipeline.get(classOf[ClientHandler]).statusFuture
} yield handle) recover { } yield handle) recover {
case c: CancellationException throw new NettyTransportExceptionNoStack("Connection was cancelled") case _: CancellationException throw new NettyTransportExceptionNoStack("Connection was cancelled")
case NonFatal(t) case NonFatal(t)
val msg = val msg =
if (t.getCause == null) if (t.getCause == null)
@ -536,7 +536,7 @@ class NettyTransport(val settings: NettyTransportSettings, val system: ExtendedA
s"${t.getMessage}, caused by: ${t.getCause}" s"${t.getMessage}, caused by: ${t.getCause}"
else else
s"${t.getMessage}, caused by: ${t.getCause}, caused by: ${t.getCause.getCause}" s"${t.getMessage}, caused by: ${t.getCause}, caused by: ${t.getCause.getCause}"
throw new NettyTransportExceptionNoStack(msg, t.getCause) throw new NettyTransportExceptionNoStack(s"${t.getClass.getName}: $msg", t.getCause)
} }
} }
} }