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

fix(Android): Catch all exceptions and redirect them to JS #202

Merged
merged 1 commit into from
Mar 22, 2022
Merged

fix(Android): Catch all exceptions and redirect them to JS #202

merged 1 commit into from
Mar 22, 2022

Conversation

eliaslecomte
Copy link
Contributor

Due to my improvement: #197, if you now try to send a packet to a closed channel, you get a RejectedExecutionException exception.

As you can see in the changed file, the send method only catches specific exceptions, and not this RejectedExecutionException. This actually causes an app to crash as this is unhandled.

But since this is a React Native library; it's better to catch all exceptions and pass them along to React Native. There, in your js/ts code, apps can try catch this and recover from this case.

How to reproduce?

  1. open a socket
  2. close a socket
  3. try to send something over that closed socket

@Rapsssito
Copy link
Collaborator

@eliaslecomte, you are right! Thanks for the PR!

@Rapsssito Rapsssito changed the title fix(android): avoid crashing when sending a packet over a closed socket fix(Android): Catch all exceptions and redirect them to JS Mar 22, 2022
@Rapsssito Rapsssito merged commit 0a512ee into tradle:master Mar 22, 2022
github-actions bot pushed a commit that referenced this pull request Mar 22, 2022
## [4.1.5](v4.1.4...v4.1.5) (2022-03-22)

### Bug Fixes

* Fix Gradle configuration ([#205](#205)) ([c5c7831](c5c7831))
* **Android:** Catch all exceptions and redirect them to JS ([#202](#202)) ([0a512ee](0a512ee))
@github-actions
Copy link

🎉 This PR is included in version 4.1.5 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants