Improve error path for list items
[netconf.git] / restconf / restconf-nb / src / main / java / org / opendaylight / restconf / nb / rfc8040 / rests / transactions / MdsalRestconfTransaction.java
index ea040a404509780bc121243b03ac4eaad910b970..7d57d36cdf848b27ae1e1c04510b94fd30856fb2 100644 (file)
@@ -89,9 +89,9 @@ final class MdsalRestconfTransaction extends RestconfTransaction {
             }
 
             // ... finally collect existence checks and abort the transaction if any of them failed.
-            if (check.getOrThrow() instanceof Conflict) {
+            if (check.getOrThrow() instanceof Conflict conflict) {
                 throw new RestconfDocumentedException("Data already exists", ErrorType.PROTOCOL, ErrorTag.DATA_EXISTS,
-                    path);
+                    conflict.path());
             }
         } else {
             RestconfStrategy.checkItemDoesNotExists(verifyNotNull(rwTx).exists(CONFIGURATION, path), path);