Bug 3017 - Error messages and logs missing for this or other RPC failures
[controller.git] / opendaylight / md-sal / sal-rest-connector / src / main / java / org / opendaylight / controller / sal / restconf / impl / BrokerFacade.java
index 24e1970ada5fe4122e68d684f576708ad0f3dfe2..b8d9561a26069aab4fbfc94bd134f729b4dd4a23 100644 (file)
@@ -86,7 +86,9 @@ public class BrokerFacade {
         if (domDataBrokerService.isPresent()) {
             return readDataViaTransaction(domDataBrokerService.get().newReadOnlyTransaction(), CONFIGURATION, path);
         }
-        throw new RestconfDocumentedException("DOM data broker service isn't available for mount point.");
+        final String errMsg = "DOM data broker service isn't available for mount point " + path;
+        LOG.warn(errMsg);
+        throw new RestconfDocumentedException(errMsg);
     }
 
     // READ operational
@@ -100,7 +102,9 @@ public class BrokerFacade {
         if (domDataBrokerService.isPresent()) {
             return readDataViaTransaction(domDataBrokerService.get().newReadOnlyTransaction(), OPERATIONAL, path);
         }
-        throw new RestconfDocumentedException("DOM data broker service isn't available for mount point.");
+        final String errMsg = "DOM data broker service isn't available for mount point " + path;
+        LOG.warn(errMsg);
+        throw new RestconfDocumentedException(errMsg);
     }
 
     // PUT configuration
@@ -117,7 +121,9 @@ public class BrokerFacade {
             return putDataViaTransaction(domDataBrokerService.get().newReadWriteTransaction(), CONFIGURATION, path,
                     payload, mountPoint.getSchemaContext());
         }
-        throw new RestconfDocumentedException("DOM data broker service isn't available for mount point.");
+        final String errMsg = "DOM data broker service isn't available for mount point " + path;
+        LOG.warn(errMsg);
+        throw new RestconfDocumentedException(errMsg);
     }
 
     // POST configuration
@@ -134,7 +140,9 @@ public class BrokerFacade {
             return postDataViaTransaction(domDataBrokerService.get().newReadWriteTransaction(), CONFIGURATION, path,
                     payload, mountPoint.getSchemaContext());
         }
-        throw new RestconfDocumentedException("DOM data broker service isn't available for mount point.");
+        final String errMsg = "DOM data broker service isn't available for mount point " + path;
+        LOG.warn(errMsg);
+        throw new RestconfDocumentedException(errMsg);
     }
 
     // DELETE configuration
@@ -150,7 +158,9 @@ public class BrokerFacade {
         if (domDataBrokerService.isPresent()) {
             return deleteDataViaTransaction(domDataBrokerService.get().newWriteOnlyTransaction(), CONFIGURATION, path);
         }
-        throw new RestconfDocumentedException("DOM data broker service isn't available for mount point.");
+        final String errMsg = "DOM data broker service isn't available for mount point " + path;
+        LOG.warn(errMsg);
+        throw new RestconfDocumentedException(errMsg);
     }
 
     // RPC
@@ -187,6 +197,7 @@ public class BrokerFacade {
                 LOG.debug("Reading result data from transaction.");
                 optional = listenableFuture.get();
             } catch (InterruptedException | ExecutionException e) {
+                LOG.warn("Exception by reading " + datastore.name() + " via Restconf: {}", path, e);
                 throw new RestconfDocumentedException("Problem to get data from transaction.", e.getCause());
 
             }
@@ -226,13 +237,13 @@ public class BrokerFacade {
         try {
             if (futureDatastoreData.get()) {
                 final String errMsg = "Post Configuration via Restconf was not executed because data already exists";
-                LOG.debug(errMsg + ":{}", path);
+                LOG.trace(errMsg + ":{}", path);
                 rWTransaction.cancel();
                 throw new RestconfDocumentedException("Data already exists for path: " + path, ErrorType.PROTOCOL,
                         ErrorTag.DATA_EXISTS);
             }
         } catch (InterruptedException | ExecutionException e) {
-            LOG.trace("It wasn't possible to get data loaded from datastore at path " + path);
+            LOG.warn("It wasn't possible to get data loaded from datastore at path " + path, e);
         }
 
     }