From 384aa54a18295db8343a8c43426f9903a82ac47b Mon Sep 17 00:00:00 2001 From: Kamal Mohammed Date: Fri, 29 Nov 2024 05:32:42 +0530 Subject: [PATCH] GRAD2-3152 - Updated logic to handle exceptions --- .../service/GradReportSignatureService.java | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/api/src/main/java/ca/bc/gov/educ/grad/report/service/GradReportSignatureService.java b/api/src/main/java/ca/bc/gov/educ/grad/report/service/GradReportSignatureService.java index efe288c6..85613220 100644 --- a/api/src/main/java/ca/bc/gov/educ/grad/report/service/GradReportSignatureService.java +++ b/api/src/main/java/ca/bc/gov/educ/grad/report/service/GradReportSignatureService.java @@ -67,7 +67,13 @@ public List getSignatureImages(String accessToken) { List result = new ArrayList(); for(GradReportSignatureImageEntity entity: entities) { GradReportSignatureImage signatureImage = gradReportSignatureTransformer.transformToDTO(entity); - DistrictImpl dist = getDistrictInfo(entity.getGradReportSignatureCode(),accessToken); + + DistrictImpl dist = null; + try { + dist = getDistrictInfo(entity.getGradReportSignatureCode(),accessToken); + } catch (Exception e) { + log.error(String.format("Cannot retrieve District information for: %s", entity.getGradReportSignatureCode())); + } if(dist != null) signatureImage.setDistrictName(dist.getDistrictName()); result.add(signatureImage); @@ -101,7 +107,13 @@ public GradReportSignatureImage getSignatureImageByCode(String code, String acce String methodName = String.format("getSignatureImageByCode(String %s)", code); log.debug(DEBUG_LOG_PATTERN, methodName, CLASS_NAME); GradReportSignatureImage signatureImage = getSignatureImageByCode(code); - DistrictImpl dist = getDistrictInfo(signatureImage.getGradReportSignatureCode(),accessToken); + + DistrictImpl dist = null; + try { + dist = getDistrictInfo(signatureImage.getGradReportSignatureCode(),accessToken); + } catch (Exception e) { + log.error(String.format("Cannot retrieve District information for: %s", signatureImage.getGradReportSignatureCode())); + } if(dist != null) signatureImage.setDistrictName(dist.getDistrictName()); log.debug(DEBUG_LOG_PATTERN, methodName, CLASS_NAME);