Skip to content

Commit

Permalink
Merge pull request #701 from bcgov/bugfix/GRAD2-3152
Browse files Browse the repository at this point in the history
GRAD2-3152 - Updated logic to handle exceptions
  • Loading branch information
infstar authored Nov 29, 2024
2 parents 8c9850e + 384aa54 commit 321e7ac
Showing 1 changed file with 14 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,13 @@ public List<GradReportSignatureImage> getSignatureImages(String accessToken) {
List<GradReportSignatureImage> 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);
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 321e7ac

Please sign in to comment.