-
-
Notifications
You must be signed in to change notification settings - Fork 472
BeforeSendCallback with custom Exception #3231
-
I have an issue with a custom exception we use on android.
So to explain a bit i use sentry with (Nativescript)[https://nativescript.org/]
With Nativescript sometimes there a custom Exception thrown: (NativescriptException)[https://github.com/NativeScript/android/blob/main/test-app/runtime/src/main/java/com/tns/NativeScriptException.java].
That custom exception holds the Js stacktrace in addition to the java one.
So for sentry event to get the JS stacktrace i need to go through io.sentry.SentryOptions.BeforeSendCallback to try and get it.
There i get the throwable from the event using event.getThrowable.() and i get the exceptions type from event.getExceptions().get(0).getType().
The type correcly refers to our custom Exception class NativescriptException but the throwable is java.lang.RuntimeException (which is the parent class) and not com.tns.NativescriptException.
This is where the issue is. I need to get com.tns.NativescriptException to access getIncomingStackTrace() on it.
At first i though this could be because com.tns.NativescriptException does not implement Serializable so i did add it (not in the repo i linked) but it still did not work.
Is there a way for me to access my correct class com.tns.NativescriptException from the event?
Beta Was this translation helpful? Give feedback.