Improve thrown exception 52/110552/1
authorRobert Varga <robert.varga@pantheon.tech>
Thu, 7 Mar 2024 18:15:57 +0000 (19:15 +0100)
committerRobert Varga <robert.varga@pantheon.tech>
Thu, 7 Mar 2024 18:17:13 +0000 (19:17 +0100)
We are hitting an missing node for some reason. Add its identity to the
message to ease debugging.

Change-Id: Ic8b14c1445434b9e82f1be07da6df3ebafe6631c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/QosRemovedCommand.java

index e46b7cac9ab1fbd0f37c73d22adc21bae622cb61..1191ee90bba84440fd33988c97a5962fc63b0507 100644 (file)
@@ -11,6 +11,7 @@ import static org.opendaylight.ovsdb.lib.operations.Operations.op;
 
 import java.util.Collection;
 import java.util.Map;
+import java.util.NoSuchElementException;
 import org.opendaylight.mdsal.binding.api.DataTreeModification;
 import org.opendaylight.ovsdb.lib.notation.UUID;
 import org.opendaylight.ovsdb.lib.operations.TransactionBuilder;
@@ -59,8 +60,9 @@ public class QosRemovedCommand implements TransactCommand {
                 Map<QosEntriesKey, QosEntries> updatedQosEntries = update.getQosEntries();
                 if (origQosEntries != null && !origQosEntries.isEmpty()) {
                     for (QosEntries origQosEntry : origQosEntries.values()) {
-                        OvsdbNodeAugmentation operNode = state.getBridgeNode(ovsdbNodeIid).orElseThrow()
-                                .augmentation(OvsdbNodeAugmentation.class);
+                        OvsdbNodeAugmentation operNode = state.getBridgeNode(ovsdbNodeIid)
+                            .orElseThrow(() -> new NoSuchElementException("Cannot find " + ovsdbNodeIid))
+                            .augmentation(OvsdbNodeAugmentation.class);
                         if (updatedQosEntries == null || !updatedQosEntries.containsKey(origQosEntry.key())) {
                             LOG.debug("Received request to delete QoS entry {}", origQosEntry.getQosId());
                             Uuid qosUuid = getQosEntryUuid(operNode.getQosEntries(), origQosEntry.key());