fix: #98 | Enhance the Try conditional recover and onFailure methods to use the predicate based methods#101
Conversation
…to use the predicate based methods
WalkthroughRefactored Try exception recovery logic to support predicate-based filtering. Added new recover and onFailure methods accepting Predicate conditions, with existing exception-type variants delegating to predicate-based implementations. Updated compose behavior to route through failureMapper when Try is in failure state. Added Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant Try
participant Predicate
participant Mapper
User->>Try: recover(predicate, mapper)
alt Exception exists
Try->>Predicate: test(exception)
alt Predicate matches
Predicate-->>Try: true
Try->>Mapper: apply(exception)
Mapper-->>Try: Try<T> (recovered)
Try-->>User: Success path
else Predicate does not match
Predicate-->>Try: false
Try-->>User: Failure path (unchanged)
end
else No exception
Try-->>User: Success path (direct)
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes
Possibly related PRs
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
src/main/java/org/zeplinko/commons/lang/ext/core/Try.java(10 hunks)src/test/java/org/zeplinko/commons/lang/ext/core/TryTest.java(4 hunks)
a-anand-91119
left a comment
There was a problem hiding this comment.
LGTM. One one concern, which is the same raised by code rabbit
|
@a-anand-91119 It will be fixed in the next version. |
closes #98
Summary by CodeRabbit
Release Notes