FINERACT-1724: Internal server error when transaction related errors happen in batch executions

This commit is contained in:
Arnold Galovics
2023-06-21 10:17:48 +02:00
committed by Arnold Gálovics
parent 3b4b5e9109
commit cf9d102e19
2 changed files with 4 additions and 4 deletions
@@ -71,12 +71,12 @@ public final class ErrorHandler {
runtimeException -> handleException(runtimeException, new PlatformDataIntegrityExceptionMapper(), 3001)); runtimeException -> handleException(runtimeException, new PlatformDataIntegrityExceptionMapper(), 3001));
EXCEPTION_HANDLERS.put(AbstractPlatformDomainRuleException.class, EXCEPTION_HANDLERS.put(AbstractPlatformDomainRuleException.class,
runtimeException -> handleException(runtimeException, new PlatformDomainRuleExceptionMapper(), 9999)); 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\": %s}".formatted(runtimeException.getMessage())));
EXCEPTION_HANDLERS.put(PlatformInternalServerException.class, EXCEPTION_HANDLERS.put(PlatformInternalServerException.class,
runtimeException -> handleException(runtimeException, new PlatformInternalServerExceptionMapper(), 5001)); runtimeException -> handleException(runtimeException, new PlatformInternalServerExceptionMapper(), 5001));
EXCEPTION_HANDLERS.put(NonTransientDataAccessException.class, runtimeException -> new ErrorInfo(HttpStatus.SC_BAD_REQUEST, 4002, EXCEPTION_HANDLERS.put(NonTransientDataAccessException.class, runtimeException -> new ErrorInfo(HttpStatus.SC_INTERNAL_SERVER_ERROR,
"{\"Exception\": %s}".formatted(runtimeException.getMessage()))); 4002, "{\"Exception\": %s}".formatted(runtimeException.getMessage())));
EXCEPTION_HANDLERS.put(DEFAULT_ERROR_HANDLER.getKey(), DEFAULT_ERROR_HANDLER.getValue()); EXCEPTION_HANDLERS.put(DEFAULT_ERROR_HANDLER.getKey(), DEFAULT_ERROR_HANDLER.getValue());
} }
@@ -199,7 +199,7 @@ public class BatchApiTest {
// Asserts that all the transactions have been successfully rolled back // Asserts that all the transactions have been successfully rolled back
Assertions.assertEquals(1, response.size()); 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");
} }
/** /**