[MS-1007] Log an exception when subjectActions are null#1201
Merged
Conversation
ybourgery
approved these changes
May 28, 2025
meladRaouf
approved these changes
May 28, 2025
luhmirin-s
approved these changes
May 28, 2025
Contributor
|
Do the CoPilot on this, out of curiosity :D |
There was a problem hiding this comment.
Pull Request Overview
Adds explicit error logging and null handling for missing enrolment records in the GetEnrolmentCreationEventForSubjectUseCase.
- Introduces a
Simber.elog whenrecordCreationEventis null - Replaces the Elvis operator with an explicit
if/elseto returnnullon 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) {
bded8de to
90f3152
Compare
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



JIRA ticket
Will be released in: 2025.2.0
Notable changes
subjectActionsare null when they shouldn'tTesting guidance
Additional work checklist