Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
Sentry.init({
...window.__SENTRY__OPTIONS,
integrations: [
new ExtraErrorData({
// 6 is arbitrary, seems like a nice number
depth: 6,
}),
new Integrations.Tracing({
tracingOrigins: ['localhost', 'sentry.io', /^\//],
tracesSampleRate,
}),
],
});
if (window.__SENTRY__USER) {
Sentry.setUser(window.__SENTRY__USER);
}
if (window.__SENTRY__VERSION) {
Sentry.setTag('sentry_version', window.__SENTRY__VERSION);
}
// Used for operational metrics to determine that the application js
// bundle was loaded by browser.
metric.mark('sentry-app-init');
// setup jquery for CSRF tokens
jQuery.ajaxSetup({
//jQuery won't allow using the ajaxCsrfSetup function directly
beforeSend: ajaxCsrfSetup,
});
const render = Component => {
function setUserInfo(user) {
Sentry.setUser(user);
}
public setUser(userInfo: UserInfo) {
Sentry.setUser(userInfo);
}
const setUserContext = ({ pk, email, contributor_name }) => {
const user = { id: pk, name: contributor_name, email }
if (process.env.NODE_ENV == 'production') Sentry.setUser(user)
}