FINERACT-1971: Enhanced error logging: Optimistic lock exception handling + log most specific exception
This commit is contained in:
+1
-1
@@ -35,7 +35,7 @@ public class LinkedAccountRequiredExceptionMapper implements FineractExceptionMa
|
||||
|
||||
@Override
|
||||
public Response toResponse(LinkedAccountRequiredException exception) {
|
||||
log.warn("Exception occurred", exception);
|
||||
log.warn("Exception occurred", ErrorHandler.findMostSpecificException(exception));
|
||||
final ApiGlobalErrorResponse notFoundErrorResponse = ApiGlobalErrorResponse.domainRuleViolation(
|
||||
exception.getGlobalisationMessageCode(), exception.getDefaultUserMessage(), exception.getDefaultUserMessageArgs());
|
||||
// request understood but not carried out due to it violating some
|
||||
|
||||
+1
-1
@@ -36,7 +36,7 @@ public class LoanIdsHardLockedExceptionMapper implements FineractExceptionMapper
|
||||
|
||||
@Override
|
||||
public Response toResponse(LoanIdsHardLockedException exception) {
|
||||
log.warn("Exception occurred", exception);
|
||||
log.warn("Exception occurred", ErrorHandler.findMostSpecificException(exception));
|
||||
return Response.status(HttpStatus.SC_CONFLICT)
|
||||
.entity(ApiGlobalErrorResponse.loanIsLocked(exception.getLoanIdFromRequest()).toJson()).type(MediaType.APPLICATION_JSON)
|
||||
.build();
|
||||
|
||||
+1
-1
@@ -36,7 +36,7 @@ public class MultiDisbursementDataRequiredExceptionMapper
|
||||
|
||||
@Override
|
||||
public Response toResponse(MultiDisbursementDataRequiredException exception) {
|
||||
log.warn("Exception occurred", exception);
|
||||
log.warn("Exception occurred", ErrorHandler.findMostSpecificException(exception));
|
||||
final ApiGlobalErrorResponse notFoundErrorResponse = ApiGlobalErrorResponse.domainRuleViolation(
|
||||
exception.getGlobalisationMessageCode(), exception.getDefaultUserMessage(), exception.getDefaultUserMessageArgs());
|
||||
// request understood but not carried out due to it violating some
|
||||
|
||||
+2
-1
@@ -25,6 +25,7 @@ import jakarta.ws.rs.ext.Provider;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.fineract.cob.exceptions.LoanAccountLockCannotBeOverruledException;
|
||||
import org.apache.fineract.infrastructure.core.data.ApiParameterError;
|
||||
import org.apache.fineract.infrastructure.core.exception.ErrorHandler;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Provider
|
||||
@@ -36,7 +37,7 @@ public class LoanAccountLockCannotBeOverruledExceptionMapper implements Exceptio
|
||||
public Response toResponse(LoanAccountLockCannotBeOverruledException exception) {
|
||||
final String globalisationMessageCode = "error.msg.invalid.request.body";
|
||||
final String defaultUserMessage = exception.getMessage();
|
||||
log.warn("Exception occurred", exception);
|
||||
log.warn("Exception occurred", ErrorHandler.findMostSpecificException(exception));
|
||||
|
||||
final ApiParameterError error = ApiParameterError.generalError(globalisationMessageCode, defaultUserMessage);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user