BeforeSendCallback with custom Exception #3231
Unanswered
farfromrefug
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
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.BeforeSendCallbackto try and get it.There i get the throwable from the event using
event.getThrowable.()and i get the exceptions type fromevent.getExceptions().get(0).getType().The type correcly refers to our custom Exception class
NativescriptExceptionbut the throwable isjava.lang.RuntimeException(which is the parent class) and notcom.tns.NativescriptException.This is where the issue is. I need to get
com.tns.NativescriptExceptionto accessgetIncomingStackTrace()on it.At first i though this could be because
com.tns.NativescriptExceptiondoes not implementSerializableso 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.NativescriptExceptionfrom the event?Beta Was this translation helpful? Give feedback.
All reactions