sentry.js 652 B

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