How to use the @sentry/react-native.setTagsContext function in @sentry/react-native

To help you get started, we’ve selected a few @sentry/react-native 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 mattermost / mattermost-mobile / app / utils / sentry / index.js View on Github external
let hasUserContext = false;
        const userContext = getUserContext(state);
        if (Object.keys(userContext).length) {
            hasUserContext = true;
            Sentry.setUserContext(userContext);
        }

        const extraContext = getExtraContext(state);
        if (Object.keys(extraContext).length) {
            Sentry.setExtraContext(extraContext);
        }

        const buildTags = getBuildTags(state);
        if (Object.keys(buildTags).length) {
            Sentry.setTagsContext(buildTags);
        }

        if (hasUserContext) {
            console.warn('Capturing with Sentry at ' + getDsn() + '...'); // eslint-disable-line no-console

            captureFunc();
        } else {
            console.warn('No user context, skipping capture'); // eslint-disable-line no-console
        }
    } catch (e) {
        // Don't want this to get into an infinite loop again...
        console.warn('Exception occured while sending to Sentry'); // eslint-disable-line no-console
        console.warn(e); // eslint-disable-line no-console
    }
}