-
-
Notifications
You must be signed in to change notification settings - Fork 31
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
Is there a way to call Sentry.captureException on the native side? #393
Comments
No way? |
This issue has gone three weeks without activity. In another week, I will close it. But! If you comment or otherwise update it, I will reset the clock, and if you label it "A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀 |
The problem is that I cannot import these files. I have to explicitly add the native Sentry SDK as a dependency in my application's build.gradle file. Is there a trick to access this transitive dependency (app -> capacitor sentry -> native sentry)? |
This issue has gone three weeks without activity. In another week, I will close it. But! If you comment or otherwise update it, I will reset the clock, and if you label it "A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀 |
no trick? |
This issue has gone three weeks without activity. In another week, I will close it. But! If you comment or otherwise update it, I will reset the clock, and if you label it "A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀 |
I want to do that as well and can't figure out how... |
For anyone that needs to do this: you can export Sentry's captureException function through the window and executeJavascript from within the native code: In Typescript:
In native Android Java:
In native iOS Swift:
You just need to call the Sentry.captureException function from within your plugins. |
Thats smart, but still huge overhead to just track a native exception through the JS layer. I have discarded all capacitor plugins and written my own version with Koin as DI. I think that is a more modern way (Plugins get their implementations injected via Koin, that way testing and invocation from native is super trivial, just thinking of Play Games Auth or Firebase restore being triggered while the JS layer is not even aware that it exists) |
I am using sentry in a capacitor project, and it is working as expected. The only thing I am wondering is if its possible to also call
Sentry.captureException
on the native side (lets say somewhere in Android native code).We are developing a lot of own plugins and extending the native code pretty heavily, so this would be really helpful.
Thanks for any leads.
The text was updated successfully, but these errors were encountered: