Use Future.cause() for error checking 49/102749/1
authorRobert Varga <robert.varga@pantheon.tech>
Tue, 18 Oct 2022 18:59:34 +0000 (20:59 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Tue, 18 Oct 2022 18:59:34 +0000 (20:59 +0200)
Include error trace when terminating session.

Change-Id: I02faabd68cf8f9ad89dc0273e9a85641d12c8db6
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
netconf/netconf-netty-util/src/main/java/org/opendaylight/netconf/nettyutil/AbstractNetconfSessionNegotiator.java

index 59f3e450b9c35b5d137bc391531a9c7a6ee28bf7..afd77d17b17ea1c59b5d970cac86a24d5d1f6fd2 100644 (file)
@@ -179,10 +179,11 @@ public abstract class AbstractNetconfSessionNegotiator<S extends AbstractNetconf
                 changeState(State.FAILED);
 
                 channel.close().addListener(future -> {
-                    if (future.isSuccess()) {
-                        LOG.debug("Channel {} closed: success", channel);
+                    final var cause = future.cause();
+                    if (cause != null) {
+                        LOG.warn("Channel {} closed: fail", channel, cause);
                     } else {
-                        LOG.warn("Channel {} closed: fail", channel);
+                        LOG.debug("Channel {} closed: success", channel);
                     }
                 });
             }