overleaf/services/web/frontend/js/utils/sentry.js
Eric Mc Sween a11a4ac614 Merge pull request #2570 from overleaf/as-sentry-source-maps
Upload source maps to Sentry

GitOrigin-RevId: badbce7a5a72c3c2b5ad61d1ab2e458a52128e37
2020-03-04 04:21:34 +00:00

18 lines
652 B
JavaScript

// Conditionally enable Sentry based on whether the DSN token is set
if (window.ExposedSettings.sentryDsn) {
import(/* webpackChunkName: "sentry" */ '@sentry/browser').then(Sentry => {
Sentry.init({
dsn: window.ExposedSettings.sentryDsn,
// Ignore errors unless they come from overleaf.com/sharelatex.com
// Adapted from: https://docs.sentry.io/platforms/javascript/#decluttering-sentry
whitelistUrls: [
/https:\/\/[a-z]+\.overleaf\.com/,
/https:\/\/[a-z]+\.sharelatex\.com/
]
})
// Previously Raven added itself as a global, so we mimic that old behaviour
window.Raven = Sentry
})
}