This is an automated email from the ASF dual-hosted git repository.

yasith pushed a commit to branch feat/airavata-service-layer
in repository https://gitbox.apache.org/repos/asf/airavata.git

commit d0415527c938c9a02df91c179c57b65fc7b4b3c2
Author: yasithdev <[email protected]>
AuthorDate: Thu Mar 26 12:24:17 2026 -0500

    fix: map ServiceNotFoundException to AiravataSystemException in 
ThriftAdapter
    
    ServiceNotFoundException was incorrectly mapped to 
ExperimentNotFoundException,
    which is semantically wrong for non-experiment resources. Map to
    AiravataSystemException with a "not found" prefix message instead, since
    there is no generic Thrift not-found exception type.
---
 .../org/apache/airavata/api/server/handler/ThriftAdapter.java  | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git 
a/airavata-api/src/main/java/org/apache/airavata/api/server/handler/ThriftAdapter.java
 
b/airavata-api/src/main/java/org/apache/airavata/api/server/handler/ThriftAdapter.java
index a7001e5400..c458de852a 100644
--- 
a/airavata-api/src/main/java/org/apache/airavata/api/server/handler/ThriftAdapter.java
+++ 
b/airavata-api/src/main/java/org/apache/airavata/api/server/handler/ThriftAdapter.java
@@ -4,7 +4,6 @@ import org.apache.airavata.common.utils.Constants;
 import org.apache.airavata.model.error.AiravataErrorType;
 import org.apache.airavata.model.error.AiravataSystemException;
 import org.apache.airavata.model.error.AuthorizationException;
-import org.apache.airavata.model.error.ExperimentNotFoundException;
 import org.apache.airavata.model.security.AuthzToken;
 import org.apache.airavata.service.context.RequestContext;
 import org.apache.airavata.service.exception.ServiceAuthorizationException;
@@ -27,14 +26,17 @@ public class ThriftAdapter {
     }
 
     public static <T> T execute(AuthzToken authzToken, String gatewayId, 
ServiceCall<T> call)
-            throws AiravataSystemException, AuthorizationException, 
ExperimentNotFoundException {
+            throws AiravataSystemException, AuthorizationException {
         try {
             RequestContext ctx = toRequestContext(authzToken, gatewayId);
             return call.apply(ctx);
         } catch (ServiceAuthorizationException e) {
             throw new AuthorizationException(e.getMessage());
         } catch (ServiceNotFoundException e) {
-            throw new ExperimentNotFoundException(e.getMessage());
+            AiravataSystemException ase = new AiravataSystemException();
+            ase.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
+            ase.setMessage("Resource not found: " + e.getMessage());
+            throw ase;
         } catch (ServiceException e) {
             AiravataSystemException ase = new AiravataSystemException();
             ase.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
@@ -51,7 +53,7 @@ public class ThriftAdapter {
     }
 
     public static void executeVoid(AuthzToken authzToken, String gatewayId, 
ServiceVoidCall call)
-            throws AiravataSystemException, AuthorizationException, 
ExperimentNotFoundException {
+            throws AiravataSystemException, AuthorizationException {
         execute(authzToken, gatewayId, ctx -> {
             call.apply(ctx);
             return null;

Reply via email to