From fba9d4b9831dcad6c73dd73a4a5af32e877123d9 Mon Sep 17 00:00:00 2001 From: Torsten Simon Date: Thu, 4 Jul 2024 14:02:52 +0200 Subject: [PATCH] fix:add detailed logging for es errors --- .../java/org/edu_sharing/restservices/DAOException.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Backend/services/core/src/main/java/org/edu_sharing/restservices/DAOException.java b/Backend/services/core/src/main/java/org/edu_sharing/restservices/DAOException.java index c17932831..b8b761fd7 100644 --- a/Backend/services/core/src/main/java/org/edu_sharing/restservices/DAOException.java +++ b/Backend/services/core/src/main/java/org/edu_sharing/restservices/DAOException.java @@ -1,5 +1,6 @@ package org.edu_sharing.restservices; +import co.elastic.clients.elasticsearch._types.ElasticsearchException; import org.alfresco.error.AlfrescoRuntimeException; import org.alfresco.repo.domain.node.NodeExistsException; import org.alfresco.repo.security.authentication.AuthenticationException; @@ -10,9 +11,12 @@ import org.alfresco.service.cmr.repository.InvalidStoreRefException; import org.alfresco.service.cmr.security.NoSuchPersonException; import org.alfresco.service.cmr.usage.ContentQuotaException; +import org.apache.log4j.Logger; +import org.edu_sharing.alfresco.RestrictedAccessException; import org.edu_sharing.alfresco.policy.NodeFileExtensionValidationException; import org.edu_sharing.alfresco.policy.NodeFileSizeExceededException; import org.edu_sharing.alfresco.policy.NodeMimetypeValidationException; +import org.edu_sharing.alfresco.service.toolpermission.ToolPermissionException; import org.edu_sharing.service.InsufficientPermissionException; import org.edu_sharing.service.NotAnAdminException; import org.edu_sharing.service.collection.DuplicateNodeException; @@ -23,6 +27,7 @@ import java.io.FileNotFoundException; import java.io.Serializable; +import java.lang.reflect.UndeclaredThrowableException; import java.security.InvalidKeyException; import java.lang.reflect.UndeclaredThrowableException; @@ -103,7 +108,9 @@ public static DAOException mapping(Throwable t,String nodeId) { ){ return DAODOIException.instance((DOIServiceException)t.getCause(),nodeId); } - + if(t instanceof ElasticsearchException) { + Logger.getLogger(DAOException.class).info("Elasticsearch error details: " + ((ElasticsearchException)t).response()); + } if (t instanceof NodeExistsException) { return new DAOValidationException(t,nodeId);