You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by sc...@apache.org on 2017/06/07 17:49:48 UTC

airavata git commit: returning meaningful error messages from the sharing service

Repository: airavata
Updated Branches:
  refs/heads/develop 59ca27bca -> 9a3141067


returning meaningful error messages from the sharing service


Project: http://git-wip-us.apache.org/repos/asf/airavata/repo
Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/9a314106
Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/9a314106
Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/9a314106

Branch: refs/heads/develop
Commit: 9a314106764d3cf8bb43367e5312c464f9f5154e
Parents: 59ca27b
Author: scnakandala <su...@gmail.com>
Authored: Wed Jun 7 13:49:43 2017 -0400
Committer: scnakandala <su...@gmail.com>
Committed: Wed Jun 7 13:49:43 2017 -0400

----------------------------------------------------------------------
 .../server/SharingRegistryServerHandler.java    | 209 ++++++++++---------
 1 file changed, 105 insertions(+), 104 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata/blob/9a314106/modules/sharing-registry/sharing-registry-server/src/main/java/org/apache/airavata/sharing/registry/server/SharingRegistryServerHandler.java
----------------------------------------------------------------------
diff --git a/modules/sharing-registry/sharing-registry-server/src/main/java/org/apache/airavata/sharing/registry/server/SharingRegistryServerHandler.java b/modules/sharing-registry/sharing-registry-server/src/main/java/org/apache/airavata/sharing/registry/server/SharingRegistryServerHandler.java
index 30b7fb9..722157e 100644
--- a/modules/sharing-registry/sharing-registry-server/src/main/java/org/apache/airavata/sharing/registry/server/SharingRegistryServerHandler.java
+++ b/modules/sharing-registry/sharing-registry-server/src/main/java/org/apache/airavata/sharing/registry/server/SharingRegistryServerHandler.java
@@ -26,6 +26,7 @@ import org.apache.airavata.sharing.registry.db.utils.DBConstants;
 import org.apache.airavata.sharing.registry.db.utils.JPAUtils;
 import org.apache.airavata.sharing.registry.models.*;
 import org.apache.airavata.sharing.registry.service.cpi.SharingRegistryService;
+import org.apache.commons.lang.exception.ExceptionUtils;
 import org.apache.thrift.TException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -69,9 +70,9 @@ public class SharingRegistryServerHandler implements SharingRegistryService.Ifac
             (new PermissionTypeRepository()).create(permissionType);
 
             return domain.domainId;
-        }catch (SharingRegistryException ex){
+        }catch (Throwable ex){
             logger.error(ex.getMessage(), ex);
-            throw ex;
+            throw new SharingRegistryException().setMessage(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
         }
     }
 
@@ -84,9 +85,9 @@ public class SharingRegistryServerHandler implements SharingRegistryService.Ifac
             domain = getUpdatedObject(oldDomain, domain);
             (new DomainRepository()).update(domain);
             return true;
-        }catch (SharingRegistryException ex) {
+        }catch (Throwable ex) {
             logger.error(ex.getMessage(), ex);
-            throw ex;
+            throw new SharingRegistryException().setMessage(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
         }
     }
 
@@ -99,9 +100,9 @@ public class SharingRegistryServerHandler implements SharingRegistryService.Ifac
     public boolean isDomainExists(String domainId) throws SharingRegistryException, TException {
         try{
             return (new DomainRepository()).isExists(domainId);
-        }catch (SharingRegistryException ex) {
+        }catch (Throwable ex) {
             logger.error(ex.getMessage(), ex);
-            throw ex;
+            throw new SharingRegistryException().setMessage(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
         }
     }
 
@@ -110,9 +111,9 @@ public class SharingRegistryServerHandler implements SharingRegistryService.Ifac
         try{
             (new DomainRepository()).delete(domainId);
             return true;
-        }catch (SharingRegistryException ex) {
+        }catch (Throwable ex) {
             logger.error(ex.getMessage(), ex);
-            throw ex;
+            throw new SharingRegistryException().setMessage(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
         }
     }
 
@@ -120,9 +121,9 @@ public class SharingRegistryServerHandler implements SharingRegistryService.Ifac
     public Domain getDomain(String domainId) throws SharingRegistryException, TException {
         try{
             return (new DomainRepository()).get(domainId);
-        }catch (SharingRegistryException ex) {
+        }catch (Throwable ex) {
             logger.error(ex.getMessage(), ex);
-            throw ex;
+            throw new SharingRegistryException().setMessage(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
         }
     }
 
@@ -130,9 +131,9 @@ public class SharingRegistryServerHandler implements SharingRegistryService.Ifac
     public List<Domain> getDomains(int offset, int limit) throws TException {
         try{
             return (new DomainRepository()).select(new HashMap<>(), offset, limit);
-        }catch (SharingRegistryException ex) {
+        }catch (Throwable ex) {
             logger.error(ex.getMessage(), ex);
-            throw ex;
+            throw new SharingRegistryException().setMessage(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
         }
     }
 
@@ -164,9 +165,9 @@ public class SharingRegistryServerHandler implements SharingRegistryService.Ifac
             (new UserGroupRepository()).create(userGroup);
 
             return user.userId;
-        }catch (SharingRegistryException ex) {
+        }catch (Throwable ex) {
             logger.error(ex.getMessage(), ex);
-            throw ex;
+            throw new SharingRegistryException().setMessage(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
         }
     }
 
@@ -190,9 +191,9 @@ public class SharingRegistryServerHandler implements SharingRegistryService.Ifac
             userGroup.setDescription("user " + user.userName + " group");
             updateGroup(userGroup);
             return true;
-        }catch (SharingRegistryException ex) {
+        }catch (Throwable ex) {
             logger.error(ex.getMessage(), ex);
-            throw ex;
+            throw new SharingRegistryException().setMessage(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
         }
     }
 
@@ -208,9 +209,9 @@ public class SharingRegistryServerHandler implements SharingRegistryService.Ifac
             userPK.setDomainId(domainId);
             userPK.setUserId(userId);
             return (new UserRepository()).isExists(userPK);
-        }catch (SharingRegistryException ex) {
+        }catch (Throwable ex) {
             logger.error(ex.getMessage(), ex);
-            throw ex;
+            throw new SharingRegistryException().setMessage(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
         }
     }
 
@@ -227,9 +228,9 @@ public class SharingRegistryServerHandler implements SharingRegistryService.Ifac
             userGroupPK.setDomainId(domainId);
             (new UserGroupRepository()).delete(userGroupPK);
             return true;
-        }catch (SharingRegistryException ex) {
+        }catch (Throwable ex) {
             logger.error(ex.getMessage(), ex);
-            throw ex;
+            throw new SharingRegistryException().setMessage(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
         }
     }
 
@@ -240,9 +241,9 @@ public class SharingRegistryServerHandler implements SharingRegistryService.Ifac
             userPK.setUserId(userId);
             userPK.setDomainId(domainId);
             return (new UserRepository()).get(userPK);
-        }catch (SharingRegistryException ex) {
+        }catch (Throwable ex) {
             logger.error(ex.getMessage(), ex);
-            throw ex;
+            throw new SharingRegistryException().setMessage(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
         }
     }
 
@@ -252,9 +253,9 @@ public class SharingRegistryServerHandler implements SharingRegistryService.Ifac
             HashMap<String, String> filters = new HashMap<>();
             filters.put(DBConstants.UserTable.DOMAIN_ID, domain);
             return (new UserRepository()).select(filters, offset, limit);
-        }catch (SharingRegistryException ex) {
+        }catch (Throwable ex) {
             logger.error(ex.getMessage(), ex);
-            throw ex;
+            throw new SharingRegistryException().setMessage(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
         }
     }
 
@@ -278,9 +279,9 @@ public class SharingRegistryServerHandler implements SharingRegistryService.Ifac
 
             addUsersToGroup(group.domainId, Arrays.asList(group.ownerId), group.groupId);
             return group.groupId;
-        }catch (SharingRegistryException ex) {
+        }catch (Throwable ex) {
             logger.error(ex.getMessage(), ex);
-            throw ex;
+            throw new SharingRegistryException().setMessage(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
         }
     }
 
@@ -302,9 +303,9 @@ public class SharingRegistryServerHandler implements SharingRegistryService.Ifac
 
             (new UserGroupRepository()).update(group);
             return true;
-        }catch (SharingRegistryException ex) {
+        }catch (Throwable ex) {
             logger.error(ex.getMessage(), ex);
-            throw ex;
+            throw new SharingRegistryException().setMessage(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
         }
     }
 
@@ -323,9 +324,9 @@ public class SharingRegistryServerHandler implements SharingRegistryService.Ifac
             userGroupPK.setDomainId(domainId);
             userGroupPK.setGroupId(groupId);
             return (new UserGroupRepository()).isExists(userGroupPK);
-        }catch (SharingRegistryException ex) {
+        }catch (Throwable ex) {
             logger.error(ex.getMessage(), ex);
-            throw ex;
+            throw new SharingRegistryException().setMessage(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
         }
     }
 
@@ -337,9 +338,9 @@ public class SharingRegistryServerHandler implements SharingRegistryService.Ifac
             userGroupPK.setDomainId(domainId);
             (new UserGroupRepository()).delete(userGroupPK);
             return true;
-        }catch (SharingRegistryException ex) {
+        }catch (Throwable ex) {
             logger.error(ex.getMessage(), ex);
-            throw ex;
+            throw new SharingRegistryException().setMessage(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
         }
     }
 
@@ -350,9 +351,9 @@ public class SharingRegistryServerHandler implements SharingRegistryService.Ifac
             userGroupPK.setGroupId(groupId);
             userGroupPK.setDomainId(domainId);
             return (new UserGroupRepository()).get(userGroupPK);
-        }catch (SharingRegistryException ex) {
+        }catch (Throwable ex) {
             logger.error(ex.getMessage(), ex);
-            throw ex;
+            throw new SharingRegistryException().setMessage(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
         }
     }
 
@@ -362,9 +363,9 @@ public class SharingRegistryServerHandler implements SharingRegistryService.Ifac
             HashMap<String, String> filters = new HashMap<>();
             filters.put(DBConstants.UserTable.DOMAIN_ID, domain);
             return (new UserGroupRepository()).select(filters, offset, limit);
-        }catch (SharingRegistryException ex) {
+        }catch (Throwable ex) {
             logger.error(ex.getMessage(), ex);
-            throw ex;
+            throw new SharingRegistryException().setMessage(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
         }
     }
 
@@ -382,9 +383,9 @@ public class SharingRegistryServerHandler implements SharingRegistryService.Ifac
                 (new GroupMembershipRepository()).create(groupMembership);
             }
             return true;
-        }catch (SharingRegistryException ex) {
+        }catch (Throwable ex) {
             logger.error(ex.getMessage(), ex);
-            throw ex;
+            throw new SharingRegistryException().setMessage(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
         }
     }
 
@@ -399,9 +400,9 @@ public class SharingRegistryServerHandler implements SharingRegistryService.Ifac
                 (new GroupMembershipRepository()).delete(groupMembershipPK);
             }
             return true;
-        }catch (SharingRegistryException ex) {
+        }catch (Throwable ex) {
             logger.error(ex.getMessage(), ex);
-            throw ex;
+            throw new SharingRegistryException().setMessage(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
         }
     }
 
@@ -411,9 +412,9 @@ public class SharingRegistryServerHandler implements SharingRegistryService.Ifac
             //TODO limit offset
             List<User> groupMemberUsers = (new GroupMembershipRepository()).getAllChildUsers(domainId, groupId);
             return groupMemberUsers;
-        }catch (SharingRegistryException ex) {
+        }catch (Throwable ex) {
             logger.error(ex.getMessage(), ex);
-            throw ex;
+            throw new SharingRegistryException().setMessage(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
         }
     }
 
@@ -423,9 +424,9 @@ public class SharingRegistryServerHandler implements SharingRegistryService.Ifac
             //TODO limit offset
             List<UserGroup> groupMemberGroups = (new GroupMembershipRepository()).getAllChildGroups(domainId, groupId);
             return groupMemberGroups;
-        }catch (SharingRegistryException ex) {
+        }catch (Throwable ex) {
             logger.error(ex.getMessage(), ex);
-            throw ex;
+            throw new SharingRegistryException().setMessage(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
         }
     }
 
@@ -444,9 +445,9 @@ public class SharingRegistryServerHandler implements SharingRegistryService.Ifac
                 (new GroupMembershipRepository()).create(groupMembership);
             }
             return true;
-        }catch (SharingRegistryException ex) {
+        }catch (Throwable ex) {
             logger.error(ex.getMessage(), ex);
-            throw ex;
+            throw new SharingRegistryException().setMessage(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
         }
     }
 
@@ -459,9 +460,9 @@ public class SharingRegistryServerHandler implements SharingRegistryService.Ifac
             groupMembershipPK.setDomainId(domainId);
             (new GroupMembershipRepository()).delete(groupMembershipPK);
             return true;
-        }catch (SharingRegistryException ex) {
+        }catch (Throwable ex) {
             logger.error(ex.getMessage(), ex);
-            throw ex;
+            throw new SharingRegistryException().setMessage(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
         }
     }
 
@@ -470,9 +471,9 @@ public class SharingRegistryServerHandler implements SharingRegistryService.Ifac
         try{
             GroupMembershipRepository groupMembershipRepository = new GroupMembershipRepository();
             return groupMembershipRepository.getAllMemberGroupsForUser(domainId, userId);
-        }catch (SharingRegistryException ex) {
+        }catch (Throwable ex) {
             logger.error(ex.getMessage(), ex);
-            throw ex;
+            throw new SharingRegistryException().setMessage(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
         }
     }
 
@@ -493,9 +494,9 @@ public class SharingRegistryServerHandler implements SharingRegistryService.Ifac
             entityType.setUpdatedTime(System.currentTimeMillis());
             (new EntityTypeRepository()).create(entityType);
             return entityType.entityTypeId;
-        }catch (SharingRegistryException ex) {
+        }catch (Throwable ex) {
             logger.error(ex.getMessage(), ex);
-            throw ex;
+            throw new SharingRegistryException().setMessage(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
         }
     }
 
@@ -511,9 +512,9 @@ public class SharingRegistryServerHandler implements SharingRegistryService.Ifac
             entityType = getUpdatedObject(oldEntityType, entityType);
             (new EntityTypeRepository()).update(entityType);
             return true;
-        }catch (SharingRegistryException ex) {
+        }catch (Throwable ex) {
             logger.error(ex.getMessage(), ex);
-            throw ex;
+            throw new SharingRegistryException().setMessage(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
         }
     }
 
@@ -529,9 +530,9 @@ public class SharingRegistryServerHandler implements SharingRegistryService.Ifac
             entityTypePK.setDomainId(domainId);
             entityTypePK.setEntityTypeId(entityTypeId);
             return (new EntityTypeRepository()).isExists(entityTypePK);
-        }catch (SharingRegistryException ex) {
+        }catch (Throwable ex) {
             logger.error(ex.getMessage(), ex);
-            throw ex;
+            throw new SharingRegistryException().setMessage(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
         }
     }
 
@@ -543,9 +544,9 @@ public class SharingRegistryServerHandler implements SharingRegistryService.Ifac
             entityTypePK.setEntityTypeId(entityTypeId);
             (new EntityTypeRepository()).delete(entityTypePK);
             return true;
-        }catch (SharingRegistryException ex) {
+        }catch (Throwable ex) {
             logger.error(ex.getMessage(), ex);
-            throw ex;
+            throw new SharingRegistryException().setMessage(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
         }
     }
 
@@ -556,9 +557,9 @@ public class SharingRegistryServerHandler implements SharingRegistryService.Ifac
             entityTypePK.setDomainId(domainId);
             entityTypePK.setEntityTypeId(entityTypeId);
             return (new EntityTypeRepository()).get(entityTypePK);
-        }catch (SharingRegistryException ex) {
+        }catch (Throwable ex) {
             logger.error(ex.getMessage(), ex);
-            throw ex;
+            throw new SharingRegistryException().setMessage(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
         }
     }
 
@@ -568,9 +569,9 @@ public class SharingRegistryServerHandler implements SharingRegistryService.Ifac
             HashMap<String, String> filters = new HashMap<>();
             filters.put(DBConstants.EntityTypeTable.DOMAIN_ID, domain);
             return (new EntityTypeRepository()).select(domain, offset, limit);
-        }catch (SharingRegistryException ex) {
+        }catch (Throwable ex) {
             logger.error(ex.getMessage(), ex);
-            throw ex;
+            throw new SharingRegistryException().setMessage(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
         }
     }
 
@@ -590,9 +591,9 @@ public class SharingRegistryServerHandler implements SharingRegistryService.Ifac
             permissionType.setUpdatedTime(System.currentTimeMillis());
             (new PermissionTypeRepository()).create(permissionType);
             return permissionType.permissionTypeId;
-        }catch (SharingRegistryException ex) {
+        }catch (Throwable ex) {
             logger.error(ex.getMessage(), ex);
-            throw ex;
+            throw new SharingRegistryException().setMessage(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
         }
     }
 
@@ -607,9 +608,9 @@ public class SharingRegistryServerHandler implements SharingRegistryService.Ifac
             permissionType = getUpdatedObject(oldPermissionType, permissionType);
             (new PermissionTypeRepository()).update(permissionType);
             return true;
-        }catch (SharingRegistryException ex) {
+        }catch (Throwable ex) {
             logger.error(ex.getMessage(), ex);
-            throw ex;
+            throw new SharingRegistryException().setMessage(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
         }
     }
 
@@ -625,9 +626,9 @@ public class SharingRegistryServerHandler implements SharingRegistryService.Ifac
             permissionTypePK.setDomainId(domainId);
             permissionTypePK.setPermissionTypeId(permissionId);
             return (new PermissionTypeRepository()).isExists(permissionTypePK);
-        }catch (SharingRegistryException ex) {
+        }catch (Throwable ex) {
             logger.error(ex.getMessage(), ex);
-            throw ex;
+            throw new SharingRegistryException().setMessage(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
         }
     }
 
@@ -639,9 +640,9 @@ public class SharingRegistryServerHandler implements SharingRegistryService.Ifac
             permissionTypePK.setPermissionTypeId(permissionTypeId);
             (new PermissionTypeRepository()).delete(permissionTypePK);
             return true;
-        }catch (SharingRegistryException ex) {
+        }catch (Throwable ex) {
             logger.error(ex.getMessage(), ex);
-            throw ex;
+            throw new SharingRegistryException().setMessage(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
         }
     }
 
@@ -652,9 +653,9 @@ public class SharingRegistryServerHandler implements SharingRegistryService.Ifac
             permissionTypePK.setDomainId(domainId);
             permissionTypePK.setPermissionTypeId(permissionTypeId);
             return (new PermissionTypeRepository()).get(permissionTypePK);
-        }catch (SharingRegistryException ex) {
+        }catch (Throwable ex) {
             logger.error(ex.getMessage(), ex);
-            throw ex;
+            throw new SharingRegistryException().setMessage(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
         }
     }
 
@@ -664,9 +665,9 @@ public class SharingRegistryServerHandler implements SharingRegistryService.Ifac
             HashMap<String, String> filters = new HashMap<>();
             filters.put(DBConstants.PermissionTypeTable.DOMAIN_ID, domain);
             return (new PermissionTypeRepository()).select(filters, offset, limit);
-        }catch (SharingRegistryException ex) {
+        }catch (Throwable ex) {
             logger.error(ex.getMessage(), ex);
-            throw ex;
+            throw new SharingRegistryException().setMessage(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
         }
     }
 
@@ -735,9 +736,9 @@ public class SharingRegistryServerHandler implements SharingRegistryService.Ifac
             }
 
             return entity.entityId;
-        }catch (SharingRegistryException ex) {
+        }catch (Throwable ex) {
             logger.error(ex.getMessage(), ex);
-            throw ex;
+            throw new SharingRegistryException().setMessage(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
         }
     }
 
@@ -755,9 +756,9 @@ public class SharingRegistryServerHandler implements SharingRegistryService.Ifac
             entity.setSharedCount((new SharingRepository()).getSharedCount(entity.domainId, entity.entityId));
             (new EntityRepository()).update(entity);
             return true;
-        }catch (SharingRegistryException ex) {
+        }catch (Throwable ex) {
             logger.error(ex.getMessage(), ex);
-            throw ex;
+            throw new SharingRegistryException().setMessage(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
         }
     }
 
@@ -773,9 +774,9 @@ public class SharingRegistryServerHandler implements SharingRegistryService.Ifac
             entityPK.setDomainId(domainId);
             entityPK.setEntityId(entityId);
             return (new EntityRepository()).isExists(entityPK);
-        }catch (SharingRegistryException ex) {
+        }catch (Throwable ex) {
             logger.error(ex.getMessage(), ex);
-            throw ex;
+            throw new SharingRegistryException().setMessage(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
         }
     }
 
@@ -788,9 +789,9 @@ public class SharingRegistryServerHandler implements SharingRegistryService.Ifac
             entityPK.setEntityId(entityId);
             (new EntityRepository()).delete(entityPK);
             return true;
-        }catch (SharingRegistryException ex) {
+        }catch (Throwable ex) {
             logger.error(ex.getMessage(), ex);
-            throw ex;
+            throw new SharingRegistryException().setMessage(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
         }
     }
 
@@ -801,9 +802,9 @@ public class SharingRegistryServerHandler implements SharingRegistryService.Ifac
             entityPK.setDomainId(domainId);
             entityPK.setEntityId(entityId);
             return (new EntityRepository()).get(entityPK);
-        }catch (SharingRegistryException ex) {
+        }catch (Throwable ex) {
             logger.error(ex.getMessage(), ex);
-            throw ex;
+            throw new SharingRegistryException().setMessage(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
         }
     }
 
@@ -815,9 +816,9 @@ public class SharingRegistryServerHandler implements SharingRegistryService.Ifac
             groupIds.add(userId);
             (new GroupMembershipRepository()).getAllParentMembershipsForChild(domainId, userId).stream().forEach(gm -> groupIds.add(gm.parentId));
             return (new EntityRepository()).searchEntities(domainId, groupIds, filters, offset, limit);
-        }catch (SharingRegistryException ex) {
+        }catch (Throwable ex) {
             logger.error(ex.getMessage(), ex);
-            throw ex;
+            throw new SharingRegistryException().setMessage(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
         }
     }
 
@@ -825,9 +826,9 @@ public class SharingRegistryServerHandler implements SharingRegistryService.Ifac
     public List<User> getListOfSharedUsers(String domainId, String entityId, String permissionTypeId) throws SharingRegistryException, TException {
         try{
             return (new UserRepository()).getAccessibleUsers(domainId, entityId, permissionTypeId);
-        }catch (SharingRegistryException ex) {
+        }catch (Throwable ex) {
             logger.error(ex.getMessage(), ex);
-            throw ex;
+            throw new SharingRegistryException().setMessage(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
         }
     }
 
@@ -835,9 +836,9 @@ public class SharingRegistryServerHandler implements SharingRegistryService.Ifac
     public List<UserGroup> getListOfSharedGroups(String domainId, String entityId, String permissionTypeId) throws SharingRegistryException, TException {
         try{
             return (new UserGroupRepository()).getAccessibleGroups(domainId, entityId, permissionTypeId);
-        }catch (SharingRegistryException ex) {
+        }catch (Throwable ex) {
             logger.error(ex.getMessage(), ex);
-            throw ex;
+            throw new SharingRegistryException().setMessage(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
         }
     }
 
@@ -856,9 +857,9 @@ public class SharingRegistryServerHandler implements SharingRegistryService.Ifac
     public boolean shareEntityWithUsers(String domainId, String entityId, List<String> userList, String permissionTypeId, boolean cascadePermission) throws SharingRegistryException, TException {
         try{
             return shareEntity(domainId, entityId, userList, permissionTypeId, cascadePermission);
-        }catch (SharingRegistryException ex) {
+        }catch (Throwable ex) {
             logger.error(ex.getMessage(), ex);
-            throw ex;
+            throw new SharingRegistryException().setMessage(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
         }
     }
 
@@ -866,9 +867,9 @@ public class SharingRegistryServerHandler implements SharingRegistryService.Ifac
     public boolean shareEntityWithGroups(String domainId, String entityId, List<String> groupList, String permissionTypeId, boolean cascadePermission) throws SharingRegistryException, TException {
         try{
             return shareEntity(domainId, entityId, groupList, permissionTypeId, cascadePermission);
-        }catch (SharingRegistryException ex) {
+        }catch (Throwable ex) {
             logger.error(ex.getMessage(), ex);
-            throw ex;
+            throw new SharingRegistryException().setMessage(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
         }
     }
 
@@ -931,9 +932,9 @@ public class SharingRegistryServerHandler implements SharingRegistryService.Ifac
             entity.setSharedCount((new SharingRepository()).getSharedCount(domainId, entityId));
             (new EntityRepository()).update(entity);
             return true;
-        }catch (SharingRegistryException ex) {
+        }catch (Throwable ex) {
             logger.error(ex.getMessage(), ex);
-            throw ex;
+            throw new SharingRegistryException().setMessage(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
         }
     }
 
@@ -944,9 +945,9 @@ public class SharingRegistryServerHandler implements SharingRegistryService.Ifac
                 throw new SharingRegistryException(OWNER_PERMISSION_NAME + " permission cannot be assigned or removed");
             }
             return revokeEntitySharing(domainId, entityId, userList, permissionTypeId);
-        }catch (SharingRegistryException ex) {
+        }catch (Throwable ex) {
             logger.error(ex.getMessage(), ex);
-            throw ex;
+            throw new SharingRegistryException().setMessage(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
         }
     }
 
@@ -958,9 +959,9 @@ public class SharingRegistryServerHandler implements SharingRegistryService.Ifac
                 throw new SharingRegistryException(OWNER_PERMISSION_NAME + " permission cannot be assigned or removed");
             }
             return revokeEntitySharing(domainId, entityId, groupList, permissionTypeId);
-        }catch (SharingRegistryException ex) {
+        }catch (Throwable ex) {
             logger.error(ex.getMessage(), ex);
-            throw ex;
+            throw new SharingRegistryException().setMessage(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
         }
     }
 
@@ -974,9 +975,9 @@ public class SharingRegistryServerHandler implements SharingRegistryService.Ifac
             groupIds.add(userId);
             return (new SharingRepository()).hasAccess(domainId, entityId, groupIds, Arrays.asList(permissionTypeId,
                     (new PermissionTypeRepository()).getOwnerPermissionTypeIdForDomain(domainId)));
-        }catch (SharingRegistryException ex) {
+        }catch (Throwable ex) {
             logger.error(ex.getMessage(), ex);
-            throw ex;
+            throw new SharingRegistryException().setMessage(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
         }
     }
 
@@ -1022,9 +1023,9 @@ public class SharingRegistryServerHandler implements SharingRegistryService.Ifac
             entity.setSharedCount((new SharingRepository()).getSharedCount(domainId, entityId));
             (new EntityRepository()).update(entity);
             return true;
-        }catch (SharingRegistryException ex) {
+        }catch (Throwable ex) {
             logger.error(ex.getMessage(), ex);
-            throw ex;
+            throw new SharingRegistryException().setMessage(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
         }
 
     }