return new ErrorInfo(400, 2002, errorBody);
} else if (exception instanceof PlatformDataIntegrityException) {
final PlatformDataIntegrityExceptionMapper mapper = new PlatformDataIntegrityExceptionMapper();
final String errorBody = jsonHelper.toJson(mapper.toResponse((PlatformDataIntegrityException) exception).getEntity());
return new ErrorInfo(403, 3001, errorBody);
} else if (exception instanceof LinkedAccountRequiredException) {
final PlatformDomainRuleExceptionMapper mapper = new PlatformDomainRuleExceptionMapper();
final String errorBody = jsonHelper.toJson(mapper.toResponse((LinkedAccountRequiredException) exception).getEntity());
return new ErrorInfo(403, 3002, errorBody);
} else if (exception instanceof MultiDisbursementDataRequiredException) {
final PlatformDomainRuleExceptionMapper mapper = new PlatformDomainRuleExceptionMapper();
final String errorBody = jsonHelper.toJson(mapper.toResponse((MultiDisbursementDataRequiredException) exception).getEntity());
return new ErrorInfo(403, 3003, errorBody);
} else if (exception instanceof TransactionException) {
return new ErrorInfo(400, 4001, "{\"Exception\": " + exception.getMessage()+"}");
} else if (exception instanceof PlatformInternalServerException) {
final PlatformInternalServerExceptionMapper mapper = new PlatformInternalServerExceptionMapper();
final String errorBody = jsonHelper.toJson(mapper.toResponse((PlatformInternalServerException) exception).getEntity());
return new ErrorInfo(500, 5001, errorBody);
}
return new ErrorInfo(500, 9999, "{\"Exception\": " + exception.toString() + "}");