From aead2eea17dbe94b6b4c87545ea7669d017910e0 Mon Sep 17 00:00:00 2001 From: Ashan Hansaka Date: Fri, 27 Sep 2024 22:25:20 +0530 Subject: [PATCH] Improve error logging (#6790) --- .../org/wso2/carbon/apimgt/impl/dao/ApiMgtDAO.java | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/dao/ApiMgtDAO.java b/components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/dao/ApiMgtDAO.java index 2775c930cb3a..ac2fd629016e 100644 --- a/components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/dao/ApiMgtDAO.java +++ b/components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/dao/ApiMgtDAO.java @@ -14030,12 +14030,10 @@ public List getBlockConditions(String tenantDomain) throws A try { connection.rollback(); } catch (SQLException ex) { - throw new APIManagementException("Failed to rollback getting Block conditions.", - ExceptionCodes.BLOCK_CONDITION_RETRIEVE_FAILED); + handleException("Failed to rollback getting Block conditions.", ex); } } - throw new APIManagementException("Failed to retrieve all block conditions for the tenant " + tenantDomain, - ExceptionCodes.BLOCK_CONDITION_RETRIEVE_FAILED); + handleException("Failed to retrieve all block conditions for the tenant " + tenantDomain, e); } finally { APIMgtDBUtil.closeAllConnections(selectPreparedStatement, connection, resultSet); } @@ -14073,9 +14071,9 @@ public List getBlockConditionsByConditionTypeAndValue(String blockConditionsDTOList.add(blockConditionsDTO); } } catch (SQLException e) { - throw new APIManagementException( - "Failed to get Block conditions by condition type: " + conditionType + " and condition value: " - + conditionValue, ExceptionCodes.BLOCK_CONDITION_RETRIEVE_FAILED); + handleException( + "Failed to get Block conditions by condition type: " + conditionType + " and condition value: " + conditionValue, + e); } finally { APIMgtDBUtil.closeAllConnections(selectPreparedStatement, connection, resultSet); }