Skip to content

Commit

Permalink
Logs and exceptions added in the code
Browse files Browse the repository at this point in the history
  • Loading branch information
githubmamatha committed Feb 20, 2025
1 parent 3cf6e14 commit ce652f5
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ public ResponseEntity<byte[]> getStudentTranscriptReport(@RequestBody ReportRequ
byte[] resultBinary = reportService.getStudentTranscriptReport(report);
return handleBinaryResponse(resultBinary, reportFile);
} catch (Exception e) {
logger.debug("ReportController" + e.getMessage());
return getInternalServerErrorResponse(e);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ public byte[] getStudentTranscriptReport(ReportRequest reportRequest) {
StudentTranscriptReport report = getStudentTranscriptReportDocument(reportRequest);
response = report.getReportData();
} catch (Exception e) {
log.debug("getStudentTranscriptReport" + e.getMessage());
throw new ReportApiServiceException(String.format(EXCEPTION_MSG, methodName), e);
}
log.debug(DEBUG_LOG_PATTERN, methodName, CLASS_NAME);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,7 @@ private synchronized StudentTranscriptReport createReport(
final GraduationData graduationData) throws DomainServiceException, IOException {
final String methodName = "createReport(...)";
LOG.entering(CLASSNAME, methodName);

try {
final TranscriptTypeCode transcriptTypeCode = transcript.getTranscriptTypeCode();

final TranscriptReport report = reportService.createTranscriptReport(transcriptTypeCode, program);
Expand Down Expand Up @@ -567,6 +567,15 @@ private synchronized StudentTranscriptReport createReport(
LOG.exiting(CLASSNAME, methodName);
return transcriptReport;
}
catch (DomainServiceException | IOException e) {
LOG.log(Level.INFO, "Error occurred in " + methodName, e.getMessage());
throw e; // Rethrow to maintain method signature behavior
} catch (Exception e) {
LOG.log(Level.INFO, "Unexpected error occurred in " + methodName, e.getMessage());
throw new RuntimeException("Unexpected error occurred while generating the student transcript report", e);
}

}

@Override
@RolesAllowed({FULFILLMENT_SERVICES_USER})
Expand All @@ -592,6 +601,7 @@ private StudentTranscriptReport getStudentTranscriptReport(
final Parameters<String, Object> parameters) throws DomainServiceException, IOException {
final String methodName = "getStudentTranscriptReport(String, ReportFormat, boolean, Parameters)";
LOG.entering(CLASSNAME, methodName);
try {
final String pen = personalEducationNumber.getValue();
final StudentInfo studentInfo = getStudentInfo(pen);

Expand All @@ -612,11 +622,11 @@ private StudentTranscriptReport getStudentTranscriptReport(

Date issueDate = transcript.getIssueDate();

if(preview && StringUtils.isNotBlank(personalEducationNumber.getEntityId())) {
if (preview && StringUtils.isNotBlank(personalEducationNumber.getEntityId())) {
LOG.log(Level.FINE, "Preview transcript get Last Update Date");
UUID graduationStudentRecordId = UUID.fromString(personalEducationNumber.getEntityId());
Optional<Date> transcriptLastUpdateDate = studentTranscriptRepository.getTranscriptLastUpdateDate(graduationStudentRecordId);
if(transcriptLastUpdateDate.isPresent()) {
if (transcriptLastUpdateDate.isPresent()) {
issueDate = transcriptLastUpdateDate.get();
}
}
Expand All @@ -639,6 +649,14 @@ private StudentTranscriptReport getStudentTranscriptReport(
LOG.exiting(CLASSNAME, methodName);
return report;
}
catch (DomainServiceException | IOException e) {
LOG.log(Level.INFO, "Error occurred in " + methodName, e.getMessage());
throw e;
} catch (Exception e) {
LOG.log(Level.INFO, "Unexpected error occurred in " + methodName, e.getMessage());
throw new RuntimeException("Unexpected error occurred while generating the student transcript report", e);
}
}

private String getCreditsUsedForGrad(final Transcript transcript) {
final List<TranscriptResult> results = transcript.getResults();
Expand Down

0 comments on commit ce652f5

Please sign in to comment.