Replies: 1 comment 1 reply
-
Hi @asindhu, You can add the captured object values in the Sentry.init({
beforeSend: (event: Sentry.Event, hint: EventHint) => {
// check if the originalException is your object and add the data as extras to the Sentry Event
if (typeof hint.originalException === 'object' && hint.originalException != null && 'key' in hint.originalException) {
event.extra = {
...event.extra,
...hint.originalException,
}
}
return event;
},
}); |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Using Sentry on react-native with Expo, totally new to Sentry and relatively new to all other pieces of this stack. In some places in my code I am trying to use Sentry to capture errors that are returned from various frameworks, in other words they are not native JS Error objects. This is how it's invoked in my code:
var error = { some error returned from a 3rd party library that's not a native JS Error }
Sentry.Native.captureException(error);
From the Sentry documentation itself, it says pretty clearly that capturing non-Error objects should be fine, and that the only issue is that you may be missing a stack trace for those:
But what I see when one of these events triggers, in the Sentry dashboard, is only the following:
It gives me this message, which is expected -- yes, my code captured a non-Error object with exactly those properties. But the actual object doesn't seem to be logged anywhere. I have the keys, but not the values!
Is there a different/better way to fully capture non-Error objects in Sentry? I don't care about the fact that the stack trace is missing, but I do care about actually seeing the whole object (keys and properties) in the Sentry dashboard for the objects I'm capturing.
Sorry in advance if this is a very basic question. I spent a lot of time going through documentation and searching online for an answer before posting this. Thanks!
Beta Was this translation helpful? Give feedback.
All reactions