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
-
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 fromevent.getExceptions().get(0).getType()
.The type correcly refers to our custom Exception class
NativescriptException
but 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.NativescriptException
to accessgetIncomingStackTrace()
on it.At first i though this could be because
com.tns.NativescriptException
does not implementSerializable
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.
All reactions