fix(android): missing listener instance try catch#110
Conversation
📝 WalkthroughWalkthroughAdded exception handling to three emitter methods in Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 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 |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@android/src/main/java/com/orientationdirector/OrientationDirectorModule.kt`:
- Around line 52-57: The current methods (e.g., sendOnDeviceOrientationChanged)
swallow all Exceptions around emitOnDeviceOrientationChanged; instead create a
small helper like ensureReactContextActive(reactContext) or
hasActiveCatalystInstance() that checks the ReactContext/CatalystInstance is
non-null and active, call that guard before invoking
emitOnDeviceOrientationChanged (and the other send* methods on lines 60-65 and
68-73), remove the broad try/catch blocks, and if you want visibility log only
unexpected errors (Log.e or processLogger.error) when the guard succeeds and an
emission actually throws — do not catch Exception broadly or hide failures.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 75542ffa-7017-4e09-bda8-108e308590cc
📒 Files selected for processing (1)
android/src/main/java/com/orientationdirector/OrientationDirectorModule.kt
Summary by CodeRabbit