Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export function initializeSentry() {
if (!Config.SentryEnabled) {
return;
}
const dsn = getDsn();
if (!dsn) {
console.warn('Sentry is enabled, but not configured on this platform'); // eslint-disable-line no-console
return;
}
Sentry.init({dsn, ...Config.SentryOptions});
}
private handleConsentUpdate(hasConsent: GdprSwitchSetting) {
this.hasConsent = hasConsent
if (hasConsent === false || hasConsent === null) return
if (!this.hasConfigured) {
Sentry.init({ dsn: SENTRY_DSN_URL })
Sentry.setTag(
'environment',
__DEV__ ? 'DEV' : isInBeta() ? 'BETA' : 'RELEASE',
)
Sentry.setExtra('react', true)
this.hasConfigured = true
}
while (this.pendingQueue.length > 0) {
const err = this.pendingQueue.pop()
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
Sentry.captureException(err!)
}
}
private handleConsentUpdate(hasConsent: GdprSwitchSetting) {
this.hasConsent = hasConsent
if (hasConsent === false || hasConsent === null) return
if (!this.hasConfigured) {
Sentry.init({ dsn: SENTRY_DSN_URL })
Sentry.setTag(
'environment',
__DEV__ ? 'DEV' : isInBeta() ? 'BETA' : 'RELEASE',
)
Sentry.setExtra('react', true)
this.hasConfigured = true
}
while (this.pendingQueue.length > 0) {
const err = this.pendingQueue.pop()
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
Sentry.captureException(err!)
}
}
export function initErrorReporting() {
Sentry.init({
dsn: sentryDSN,
release: `${VersionNumber.bundleIdentifier}@${VersionNumber.appVersion}`,
// disable automatic reporting of errors/rejections without user consent
integrations: defaultIntegrations =>
defaultIntegrations.filter(i => i.name !== 'ReactNativeErrorHandlers'),
/**
* @param event
* @dev TODO Decide if event.contexts.app should be stripped
*/
beforeSend: event => {
const { extra, contexts } = event
if (extra && contexts) {