Catch react native warnings
OS:
- [ ] Windows
- [x ] MacOS
- [ ] Linux
Platform:
- [ x] iOS
- [ x] Android
SDK:
- [ x]
@sentry/react-native - [ ]
react-native-sentry
react-native version: 0.59.9
Init Code:
Sentry.init({
dsn: 'SELF_HOSTED_URL.'
});
I have following issue: Catching errors works well, but no warnings sent to sentry
Description: Is ist possible to catch also the react native warnings ? I mean the warnings appearing in the yellow boxes.
If you update to 1.3.0 you should also get console statements.
Update to 1.3.0 change nothing, only errors sent to sentry. Is any configuration necessary?
@tilonet have you found the solution? I'm also facing the same issue
As clarification, warnings are not sent as separate events/issues but as breadcrumbs in subsequent events.
You can use this code block.
Sentry.init({
dsn: 'YOUR_DSN',
enableInExpoDevelopment: true,
debug: true, // If `true`, Sentry will try to print out useful debugging information if something goes wrong with sending the event. Set it to `false` in production
beforeBreadcrumb(event, hint) {
if (event.level !== 'log' && event.category !== 'xhr' && event.level !== 'info' && !event.message?.startsWith('Error')) {
SentryRN.captureMessage(event.message ? event.message.replace(/\%s/g, '\n') : 'Warning without message', SentryRN.Severity.Warning);
}
return event;
},
});