SentryEvent does not return original exception
Platform
iOS
Environment
Production, Develop
Installed
Manually
Version
8.24.0
Xcode Version
15.4
Did it work on previous versions?
idk
Steps to Reproduce
- throw exception
- See
errorvariable is empty.
Expected Result
Exception should appear in the Error variable.
Actual Result
Are you willing to submit a PR?
No response
### 🛑 Blocked by
- [ ] https://github.com/getsentry/sentry-cocoa/issues/2325
Hello @barisyild, thanks for reaching out. You will find your exception in the exceptions property.
The error property is meant for errors that happen while processing the event.
If I misunderstood your issue, please reach out and we will reopen it.
Unfortunately this doesn't work for me because I need to read the original exception object.
Sentry JavaScript SDK has originalException for this.
https://docs.sentry.io/platforms/javascript/configuration/filtering/#event-hints
This is not related to crashes, but to handled exceptions then? Is this correct?
To understand this better:
How are you triggering the exception and how are you using Sentry to handle the event? Can you provide a snippet of your implementation?
This is not related to crashes, but to handled exceptions then? Is this correct?
To understand this better:
How are you triggering the exception and how are you using Sentry to handle the event? Can you provide a snippet of your implementation?
I can summarize it like this; I throw special exceptions, and i want to send extra and context for these exceptions.
You can think of it like this; Some exception types are special and I need to take data from the variables in them and add them to the sentry data.
Example scenario; InterpreterException contains error details and lines related to the executed language.
I look at the Exception type and if it is InterpreterException I set extra and context.
Right now, the Sentry Apple SDK doesn't keep the original exception in the event. This is something that we need to discuss.
Right now, the Sentry Apple SDK doesn't keep the original exception in the event. This is something that we need to discuss.
I think all sentry targets should have ExceptionProcessor.
So can both override/replace/reject the exception and send extra data to the exception for its scope.
Like This; https://docs.sentry.io/platforms/javascript/enriching-events/event-processors/
Sentry.addExceptionProcessor
Right now, the Sentry Apple SDK doesn't keep the original exception in the event. This is something that we need to discuss.
I think all sentry targets should have ExceptionProcessor.
So can both override/replace/reject the exception and send extra data to the exception for its scope.
Like This; https://docs.sentry.io/platforms/javascript/enriching-events/event-processors/
Sentry.addExceptionProcessor
Sometimes I need to catch exceptions inside some exceptions, I think processor is a must.
I wrote a custom captureException for this but it doesn't work for unhandled.
I think all sentry targets should have ExceptionProcessor.
So can both override/replace/reject the exception and send extra data to the exception for its scope.
You can use beforeSend callback for this.
SentrySDK.start { options in
options.dsn = dsn
options.beforeSend = { event in
return event
}
}
I think all sentry targets should have ExceptionProcessor.
So can both override/replace/reject the exception and send extra data to the exception for its scope.
You can use
beforeSendcallback for this.SentrySDK.start { options in options.dsn = dsn options.beforeSend = { event in return event } }
This is the EventProcessor, not the same thing.
You can't read/replace original exception.
I think all sentry targets should have ExceptionProcessor.
So can both override/replace/reject the exception and send extra data to the exception for its scope.
You can use
beforeSendcallback for this.SentrySDK.start { options in options.dsn = dsn options.beforeSend = { event in return event } }This is the EventProcessor, not the same thing.
You can't read/replace original exception.
Moreover, this works at event level, the structure I mentioned will work at scope level.
More information shared at https://discord.com/channels/621778831602221064/1263605605051142204/1263605605051142204
We can/should solve this using hints, similar to how JS does.