How to use the @sentry/browser.getCurrentHub function in @sentry/browser

To help you get started, we’ve selected a few @sentry/browser examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github sourcegraph / sourcegraph / browser / src / libs / sentry / index.ts View on Github external
observeStorageKey('sync', 'featureFlags').subscribe((flags = featureFlagDefaults) => {
        const allowed = flags.allowErrorReporting

        // Don't initialize if user hasn't allowed us to report errors or in Phabricator.
        if (!allowed || isInPage) {
            const client = Sentry.getCurrentHub().getClient()
            if (client) {
                client.getOptions().enabled = false
            }
            return
        }

        callSentryInit(browser.runtime.id)

        Sentry.configureScope(scope => {
            scope.setTag('script', script)
            scope.setTag('extension_version', getExtensionVersion())
            if (codeHost) {
                scope.setTag('code_host', codeHost)
            }
        })
    })
github getsentry / sentry-react-native / src / js / sdk.ts View on Github external
export function nativeCrash(): void {
  const client = getCurrentHub().getClient();
  if (client) {
    client.nativeCrash();
  }
}