Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

recording: OnTouchEventListener try catch guard to swallow unexpected errors take 2 #196

Merged
merged 2 commits into from
Oct 9, 2024

Conversation

marandaneto
Copy link
Member

💡 Motivation and Context

Tries to fix https://github.com/PostHog/posthog-react-native-session-replay/issues/4
It's unclear if PostHog SDK is responsible for that, since the SDK intercepts the touch, the SDK will be always part of the stack trace, it does not mean its the SDK causing it.

💚 How did you test it?

📝 Checklist

  • I reviewed the submitted code.
  • I added tests to verify the changes.
  • I updated the docs if needed.
  • No breaking change or entry added to the changelog.

}
} catch (e: Throwable) {
config.logger.log("Executor#OnTouchEventListener $motionEvent failed: $e.")
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if this happens, its our fault

Comment on lines +244 to +245
config.logger.log("TouchEventInterceptor $motionEvent failed: $e.")
throw e
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if this happens, its not our fault

@@ -216,27 +216,34 @@ public class PostHogReplayIntegration(
}

private val onTouchEventListener =
OnTouchEventListener { motionEvent ->
TouchEventInterceptor { motionEvent, dispatch ->
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changed to a lower level interceptor, so we call the dispatch and log out

@marandaneto marandaneto requested a review from a team October 7, 2024 13:52
@marandaneto marandaneto marked this pull request as ready for review October 7, 2024 13:52
Copy link

@ioannisj ioannisj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only comment is that we may want to move the isSessionReplayEnabled check to when generateMouseInteractios is called so we get some error logs even when session replay is not enabled. If that makes sense to you. Otherwise LGMT

@marandaneto
Copy link
Member Author

Only comment is that we may want to move the isSessionReplayEnabled check to when generateMouseInteractios is called so we get some error logs even when session replay is not enabled. If that makes sense to you. Otherwise LGMT

this code is not even executed if session replay is disabled, so moving the check would not have any effect

@marandaneto marandaneto merged commit 629bcc1 into main Oct 9, 2024
6 checks passed
@marandaneto marandaneto deleted the fix/OnTouchEventListener-take2 branch October 9, 2024 15:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Session replay on Android crashed and cannot pass Play Store review
2 participants