Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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
}
}