Improve failure message 20/103620/13
authorRobert Varga <robert.varga@pantheon.tech>
Tue, 6 Dec 2022 23:07:14 +0000 (00:07 +0100)
committerRobert Varga <robert.varga@pantheon.tech>
Thu, 8 Dec 2022 01:21:24 +0000 (02:21 +0100)
When we are failing a future, make sure to include the name of the node.

Change-Id: If721b9dcef4b9fca23d087db6be3b73897008575
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
netconf/netconf-topology/src/main/java/org/opendaylight/netconf/topology/spi/AbstractNetconfTopology.java

index c7dbb703de40c0a1e585e46d15ce5b89b8925bef..974b0be68efd826bb54d7267c25428e2a284ddd2 100644 (file)
@@ -170,12 +170,13 @@ public abstract class AbstractNetconfTopology implements NetconfTopology {
 
     @Override
     public ListenableFuture<Empty> disconnectNode(final NodeId nodeId) {
-        LOG.debug("Disconnecting RemoteDevice{{}}", nodeId.getValue());
+        final var nodeName = nodeId.getValue();
+        LOG.debug("Disconnecting RemoteDevice{{}}", nodeName);
 
         final NetconfConnectorDTO connectorDTO = activeConnectors.remove(nodeId);
         if (connectorDTO == null) {
             return Futures.immediateFailedFuture(
-                new IllegalStateException("Unable to disconnect device that is not connected"));
+                new IllegalStateException("Cannot disconnect " + nodeName + " as it is not connected"));
         }
 
         connectorDTO.close();