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

arnold pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/fineract.git


The following commit(s) were added to refs/heads/develop by this push:
     new cf9d102e1 FINERACT-1724: Internal server error when transaction 
related errors happen in batch executions
cf9d102e1 is described below

commit cf9d102e190dfc4d9259c491dbd9c1917b1dc252
Author: Arnold Galovics <[email protected]>
AuthorDate: Tue Jun 20 13:18:00 2023 +0200

    FINERACT-1724: Internal server error when transaction related errors happen 
in batch executions
---
 .../main/java/org/apache/fineract/batch/exception/ErrorHandler.java | 6 +++---
 .../java/org/apache/fineract/integrationtests/BatchApiTest.java     | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git 
a/fineract-core/src/main/java/org/apache/fineract/batch/exception/ErrorHandler.java
 
b/fineract-core/src/main/java/org/apache/fineract/batch/exception/ErrorHandler.java
index f8efb0867..ed172df98 100644
--- 
a/fineract-core/src/main/java/org/apache/fineract/batch/exception/ErrorHandler.java
+++ 
b/fineract-core/src/main/java/org/apache/fineract/batch/exception/ErrorHandler.java
@@ -71,12 +71,12 @@ public final class ErrorHandler {
                 runtimeException -> handleException(runtimeException, new 
PlatformDataIntegrityExceptionMapper(), 3001));
         EXCEPTION_HANDLERS.put(AbstractPlatformDomainRuleException.class,
                 runtimeException -> handleException(runtimeException, new 
PlatformDomainRuleExceptionMapper(), 9999));
-        EXCEPTION_HANDLERS.put(TransactionException.class, runtimeException -> 
new ErrorInfo(HttpStatus.SC_BAD_REQUEST, 4001,
+        EXCEPTION_HANDLERS.put(TransactionException.class, runtimeException -> 
new ErrorInfo(HttpStatus.SC_INTERNAL_SERVER_ERROR, 4001,
                 "{\"Exception\": 
%s}".formatted(runtimeException.getMessage())));
         EXCEPTION_HANDLERS.put(PlatformInternalServerException.class,
                 runtimeException -> handleException(runtimeException, new 
PlatformInternalServerExceptionMapper(), 5001));
-        EXCEPTION_HANDLERS.put(NonTransientDataAccessException.class, 
runtimeException -> new ErrorInfo(HttpStatus.SC_BAD_REQUEST, 4002,
-                "{\"Exception\": 
%s}".formatted(runtimeException.getMessage())));
+        EXCEPTION_HANDLERS.put(NonTransientDataAccessException.class, 
runtimeException -> new ErrorInfo(HttpStatus.SC_INTERNAL_SERVER_ERROR,
+                4002, "{\"Exception\": 
%s}".formatted(runtimeException.getMessage())));
         EXCEPTION_HANDLERS.put(DEFAULT_ERROR_HANDLER.getKey(), 
DEFAULT_ERROR_HANDLER.getValue());
     }
 
diff --git 
a/integration-tests/src/test/java/org/apache/fineract/integrationtests/BatchApiTest.java
 
b/integration-tests/src/test/java/org/apache/fineract/integrationtests/BatchApiTest.java
index eac30e78f..471d5bc32 100644
--- 
a/integration-tests/src/test/java/org/apache/fineract/integrationtests/BatchApiTest.java
+++ 
b/integration-tests/src/test/java/org/apache/fineract/integrationtests/BatchApiTest.java
@@ -199,7 +199,7 @@ public class BatchApiTest {
 
         // Asserts that all the transactions have been successfully rolled back
         Assertions.assertEquals(1, response.size());
-        Assertions.assertEquals((long) 400, (long) 
response.get(0).getStatusCode(), "Verify Status code 400");
+        Assertions.assertEquals((long) 500, (long) 
response.get(0).getStatusCode(), "Verify Status code 500");
     }
 
     /**

Reply via email to