fix: Prevent error on searching component if there is no component#1167
fix: Prevent error on searching component if there is no component#1167
Conversation
|
🧙 Sourcery has finished reviewing your pull request! Tips
|
WalkthroughThe update introduces enhanced error handling in the Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant napari_image_view
participant ROI
User->>napari_image_view: Trigger _search_component
napari_image_view->>ROI: Access bound_info
alt bound_info is empty
napari_image_view-->>User: Return early (no processing)
else bound_info is not empty
napari_image_view->>ROI: Calculate max_components
napari_image_view-->>User: Continue processing
end
Poem
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? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configuration File (
|
There was a problem hiding this comment.
We've reviewed this pull request using the Sourcery rules engine. If you would also like our AI-powered code review then let us know.
|
|
@coderabbitai review |
Actions performedReview triggered.
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #1167 +/- ##
===========================================
- Coverage 93.06% 93.04% -0.02%
===========================================
Files 209 209
Lines 32829 32834 +5
===========================================
Hits 30552 30552
- Misses 2277 2282 +5 ☔ View full report in Codecov by Sentry. |
|
@coderabbitai review |
Actions performedReview triggered.
|
|
@coderabbitai review |
Actions performedReview triggered.
|
There was a problem hiding this comment.
Actionable comments posted: 1
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- package/PartSeg/common_gui/napari_image_view.py (1 hunks)
Additional context used
GitHub Check: codecov/patch
package/PartSeg/common_gui/napari_image_view.py
[warning] 846-851: package/PartSeg/common_gui/napari_image_view.py#L846-L851
Added lines #L846 - L851 were not covered by tests
| try: | ||
| max_components = max(max(image_info.roi_info.bound_info) for image_info in self.image_info.values()) | ||
| except ValueError as e: | ||
| if "empty" in e.args[0]: | ||
| return | ||
| raise e |
There was a problem hiding this comment.
LGTM! But add tests for the new error handling logic.
The error handling logic is correctly implemented. However, the new lines are not covered by tests.
Do you want me to generate the unit testing code or open a GitHub issue to track this task?
Tools
GitHub Check: codecov/patch
[warning] 846-851: package/PartSeg/common_gui/napari_image_view.py#L846-L851
Added lines #L846 - L851 were not covered by tests



fix PARTSEG-VD
Summary by CodeRabbit
This change enhances the application's stability and user experience by ensuring smoother operation under edge cases.