Skip to content

[MS-1007] Log an exception when subjectActions are null#1201

Merged
BurningAXE merged 1 commit into
mainfrom
log_missing_subject_actions
May 28, 2025
Merged

[MS-1007] Log an exception when subjectActions are null#1201
BurningAXE merged 1 commit into
mainfrom
log_missing_subject_actions

Conversation

@BurningAXE
Copy link
Copy Markdown
Contributor

@BurningAXE BurningAXE commented May 27, 2025

JIRA ticket
Will be released in: 2025.2.0

Notable changes

  • Added a logged exception in case subjectActions are null when they shouldn't

Testing guidance

  • Describe how the reviewers can verify that issue is fixed

Additional work checklist

  • Effect on other features and security has been considered
  • Design document marked as "In development" (if applicable)
  • External (Gitbook) and internal (Confluence) Documentation is up to date (or ticket created)
  • Test cases in Testiny are up to date (or ticket created)
  • Other teams notified about the changes (if applicable)

@cla-bot cla-bot Bot added the ... label May 27, 2025
@BurningAXE BurningAXE requested review from a team, TristramN, alex-vt, alexandr-simprints, luhmirin-s, meladRaouf and ybourgery and removed request for a team May 27, 2025 16:34
@luhmirin-s
Copy link
Copy Markdown
Contributor

Do the CoPilot on this, out of curiosity :D

@BurningAXE BurningAXE requested a review from Copilot May 28, 2025 09:06
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Adds explicit error logging and null handling for missing enrolment records in the GetEnrolmentCreationEventForSubjectUseCase.

  • Introduces a Simber.e log when recordCreationEvent is null
  • Replaces the Elvis operator with an explicit if/else to return null on failure
Comments suppressed due to low confidence (2)

feature/client-api/src/main/java/com/simprints/feature/clientapi/usecases/GetEnrolmentCreationEventForSubjectUseCase.kt:42

  • [nitpick] The log message references 'subjectActions', which isn't defined in this context. Consider clarifying it to something like "Couldn't find enrolment creation event for subjectId: $subjectId" to avoid confusion.
Simber.e("Couldn't find enrolment for subjectActions", IllegalStateException("No enrolment record found for subjectId: $subjectId"))

feature/client-api/src/main/java/com/simprints/feature/clientapi/usecases/GetEnrolmentCreationEventForSubjectUseCase.kt:41

  • The new null branch with logging isn't covered by existing tests. Add a test to verify that an exception is logged when no enrolment record is found for a subject.
if (recordCreationEvent == null) {

@BurningAXE BurningAXE force-pushed the log_missing_subject_actions branch from bded8de to 90f3152 Compare May 28, 2025 09:24
@sonarqubecloud
Copy link
Copy Markdown

@BurningAXE BurningAXE merged commit ca8ca14 into main May 28, 2025
12 checks passed
@luhmirin-s luhmirin-s deleted the log_missing_subject_actions branch May 29, 2025 08:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants