Closed krhrtky closed 2 months ago
This update refactors error handling within several Kotlin classes, optimizing the processing logic for attendance and user services. By adopting the com.github.michaelbull.result
library's toResultOr
and flatMap
functions, it enhances error management and operation chaining across the codebase, including tests, for more robust and readable implementations.
File Path | Changes Summary |
---|---|
backend/applications/src/main/kotlin/.../attendance/AttendanceApplicationService.kt |
Refactored error handling using flatMap and toResultOr for better chaining of operations. |
backend/applications/src/main/kotlin/.../users/UserApplicationService.kt |
Modified import statements and refactored the find function to use toResultOr for error handling. |
backend/applications/src/test/kotlin/.../attendance/AttendanceApplicationServiceTest.kt |
Revised assertions and removed unnecessary imports, simplifying error handling in test cases. |
backend/domains/src/main/kotlin/.../entities/attendance/Attendance.kt |
Added imports and revised logic for handling attendance records, integrating new error handling improvements. |
backend/domains/src/test/kotlin/.../entities/attendance/AttendanceTest.kt |
Updated assertions to use result.isOk and removed an unused private variable. |
In the world of code so bright,
Error chains refactored right,
ToResultOr and FlatMap we sing,
With tests that make our hearts take wing.
Bugs now flee, in sheer delight,
CodeRabbit’s touch, a coder’s night,
🌟✨ All systems good, shining light. ✨🌟
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
Failed to generate code suggestions for PR
Summary by CodeRabbit
Refactor
Tests