diff --git a/src/main/java/org/gcube/informationsystem/resourceregistry/er/ERManagement.java b/src/main/java/org/gcube/informationsystem/resourceregistry/er/ERManagement.java index 2ca7fcf..e905738 100644 --- a/src/main/java/org/gcube/informationsystem/resourceregistry/er/ERManagement.java +++ b/src/main/java/org/gcube/informationsystem/resourceregistry/er/ERManagement.java @@ -440,8 +440,10 @@ public abstract class ERManagement { return true; } catch (ResourceRegistryException e) { + logger.error("Unable to find {} with UUID {}", accessType.getName(), uuid); throw e; } catch (Exception e) { + logger.error("Unable to find {} with UUID {}", accessType.getName(), uuid, e); throw new ResourceRegistryException(e); } finally { if (orientGraph != null) { @@ -464,11 +466,13 @@ public abstract class ERManagement { return serialize(); } catch (ResourceRegistryException e) { + logger.error("Unable to create {}", accessType.getName()); if (orientGraph != null) { orientGraph.rollback(); } throw e; } catch (Exception e) { + logger.error("Unable to create {}", accessType.getName(), e); if (orientGraph != null) { orientGraph.rollback(); } @@ -490,8 +494,10 @@ public abstract class ERManagement { return serialize(); } catch (ResourceRegistryException e) { + logger.error("Unable to read {} with UUID {}", accessType.getName(), uuid); throw e; } catch (Exception e) { + logger.error("Unable to read {} with UUID {}", accessType.getName(), uuid, e); throw new ResourceRegistryException(e); } finally { if (orientGraph != null) { @@ -517,11 +523,13 @@ public abstract class ERManagement { // TODO Serialized resource is the old version. This really strange and should be an orient bug } catch (ResourceRegistryException e) { + logger.error("Unable to update {} with UUID {}", accessType.getName(), uuid); if (orientGraph != null) { orientGraph.rollback(); } throw e; } catch (Exception e) { + logger.error("Unable to update {} with UUID {}", accessType.getName(), uuid, e); if (orientGraph != null) { orientGraph.rollback(); } @@ -557,7 +565,7 @@ public abstract class ERManagement { return deleted; } catch (ResourceRegistryException e) { - logger.error("Unable to delete {} with UUID {}", accessType.getName(), uuid, e); + logger.error("Unable to delete {} with UUID {}", accessType.getName(), uuid); if (orientGraph != null) { orientGraph.rollback(); } @@ -575,7 +583,7 @@ public abstract class ERManagement { } } - public boolean addToContext() throws ERNotFoundException, ContextException { + public boolean addToContext() throws ERNotFoundException, ContextException, ResourceRegistryException { logger.debug("Going to add {} with UUID {} to actual Context", accessType.getName(), uuid); @@ -590,6 +598,13 @@ public abstract class ERManagement { accessType.getName(), uuid); return added; + } catch (ResourceRegistryException e) { + logger.error("Unable to add {} with UUID {} to actual Context", + accessType.getName(), uuid); + if (orientGraph != null) { + orientGraph.rollback(); + } + throw e; } catch (Exception e) { logger.error("Unable to add {} with UUID {} to actual Context", accessType.getName(), uuid, e); @@ -604,7 +619,7 @@ public abstract class ERManagement { } } - public boolean removeFromContext() throws ERNotFoundException, ContextException { + public boolean removeFromContext() throws ERNotFoundException, ContextException, ResourceRegistryException { logger.debug("Going to remove {} with UUID {} from actual Context", accessType.getName(), uuid); @@ -620,6 +635,13 @@ public abstract class ERManagement { accessType.getName(), uuid); return removed; + } catch (ResourceRegistryException e) { + logger.error("Unable to remove {} with UUID {} from actual Context", + accessType.getName(), uuid); + if (orientGraph != null) { + orientGraph.rollback(); + } + throw e; } catch (Exception e) { logger.error( "Unable to remove {} with UUID {} from actual Context",