Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
try {
const state = store.getState();
const config = getConfig(state);
// Don't contact Sentry if we're connected to a server with diagnostics disabled. Note that this will
// still log if we're not connected to any server.
if (config && config.EnableDiagnostics != null && config.EnableDiagnostics !== 'true') {
return;
}
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();