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

discuss: Android catches all plugin exceptions and logs message while iOS allows them to crash the app. Should they be made to work the same across platforms? #2150

Closed
josh-m-sharpe opened this issue Nov 8, 2019 · 7 comments · Fixed by #2512
Labels
Milestone

Comments

@josh-m-sharpe
Copy link
Contributor

In trying to create a plugin for Firebase Crashlytics, it seems that @capacitor/ios allows exceptions within a plugin method to bubble all the way up and crash the app and @capacitor/android catches all exceptions and logs a simple message. Android code is here and here.

To me, the Android implementation seems like it could hide problems within the plugin, never to be seen or reported by tools like Crashlytics. While good intentioned, this seems like a bad idea overall.

Would the Capacitor team welcome PRs that remove the exception catching logic from the android platform?

@priyankpat
Copy link
Contributor

I wouldn't necessarily remove exception checks and use notifyListener to transmit errors, which can be handled by the web app?

@josh-m-sharpe
Copy link
Contributor Author

I think that approach would work too. Either way, I suspect it makes sense to update all platforms to work the same.

It would be good to hear from the internal team on this though.

@jcesarmobile
Copy link
Member

I agree, will add this to the 2.0.0 milestone

@jcesarmobile jcesarmobile added this to the 2.0.0 milestone Jan 17, 2020
@jcesarmobile jcesarmobile added the needs discussion decisions must be made before working on it label Feb 24, 2020
@nphyatt
Copy link

nphyatt commented Mar 2, 2020

My gut says that it would be ideal to not catch the unexpected exceptions similar to how a regular native app would work. Plugins should catch exceptions they expect and return the appropriate responses. If an exception occurs that is not expected code should be fixed to handle it as the web side of the app really has no context in how to do so.

@jcesarmobile
Copy link
Member

@josh-m-sharpe, I've sent a PR, let me know what do you think

@josh-m-sharpe
Copy link
Contributor Author

Seems solid. Thanks!

@ionitron-bot
Copy link

ionitron-bot bot commented Nov 12, 2022

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Capacitor, please create a new issue and ensure the template is fully filled out.

@ionitron-bot ionitron-bot bot locked and limited conversation to collaborators Nov 12, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants