sentry.pug 3.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. - if (typeof(sentryPublicDSN) != "undefined")
  2. script(type="text/javascript").
  3. require.config({
  4. paths: {
  5. 'raven': 'libs/raven-3.27.0.min'
  6. }
  7. });
  8. require(["raven"], function(Raven) {
  9. if (typeof(Raven) != "undefined" && Raven.config) {
  10. Raven.config("#{sentryPublicDSN}", {
  11. tags: { 'commit': '@@COMMIT@@', 'build': '@@RELEASE@@' },
  12. release: '@@RELEASE@@',
  13. // Ignore list based off: https://gist.github.com/1878283
  14. ignoreErrors: [
  15. 'DealPly',
  16. // Random plugins/extensions
  17. 'top.GLOBALS',
  18. // See: http://blog.errorception.com/2012/03/tale-of-unfindable-js-error.html
  19. 'originalCreateNotification',
  20. 'canvas.contentDocument',
  21. 'MyApp_RemoveAllHighlights',
  22. 'http://tt.epicplay.com',
  23. 'Can\'t find variable: ZiteReader',
  24. 'jigsaw is not defined',
  25. 'ComboSearch is not defined',
  26. 'http://loading.retry.widdit.com/',
  27. 'atomicFindClose',
  28. // Facebook borked
  29. 'fb_xd_fragment',
  30. // ISP optimizing proxy - `Cache-Control: no-transform` seems to reduce this. (thanks @acdha)
  31. // See http://stackoverflow.com/questions/4113268/how-to-stop-javascript-injection-from-vodafone-proxy
  32. 'bmi_SafeAddOnload',
  33. 'EBCallBackMessageReceived',
  34. // See http://toolbar.conduit.com/Developer/HtmlAndGadget/Methods/JSInjection.aspx
  35. 'conduitPage',
  36. '/NS_ERROR_NOT_CONNECTED/i',
  37. "/Cannot read property 'row' of undefined/i",
  38. 'TypeError: start is undefined'
  39. ],
  40. ignoreUrls: [
  41. // Facebook flakiness
  42. /graph\.facebook\.com/i,
  43. // Facebook blocked
  44. /connect\.facebook\.net\/en_US\/all\.js/i,
  45. // Woopra flakiness
  46. /eatdifferent\.com\.woopra-ns\.com/i,
  47. /static\.woopra\.com\/js\/woopra\.js/i,
  48. // Chrome extensions
  49. /extensions\//i,
  50. /^chrome:\/\//i,
  51. // Other plugins
  52. /127\.0\.0\.1:4001\/isrunning/i, // Cacaoweb
  53. /webappstoolbarba\.texthelp\.com\//i,
  54. /metrics\.itunes\.apple\.com\.edgesuite\.net\//i,
  55. /a\.disquscdn\.com/i,
  56. /platform\.twitter\.com/i,
  57. /pstatic\.datafastguru\.info/i
  58. ],
  59. shouldSendCallback: function(data) {
  60. // only send a fraction of errors
  61. var sampleRate = 0.01;
  62. return (Math.random() <= sampleRate);
  63. },
  64. dataCallback: function(data) {
  65. // remove circular references from object
  66. var cache = [];
  67. var s = JSON.stringify(data, function(k, v) { if (typeof v === 'object' && v !== null) { if (cache.indexOf(v) !== -1) return "[circular]"; cache.push(v); }; return v; });
  68. return JSON.parse(s);
  69. }
  70. // we highly recommend restricting exceptions to a domain in order to filter out clutter
  71. // whitelistUrls: ['example.com/scripts/']
  72. }).install();
  73. //- We conditionally depend on Raven (based on whether the sentry
  74. //- config is set or not). This does not play well with require.js when
  75. //- minifying as it is expecting all dependencies to be defined at
  76. //- compile time. Previously Raven added itself as a global, so we just
  77. //- mimic that old behaviour
  78. window.Raven = Raven
  79. }
  80. }, function(err) {
  81. console.log(">> error loading raven", err);
  82. })
  83. - if (user && typeof(user) != "undefined" && typeof (user.email) != "undefined")
  84. script(type="text/javascript").
  85. if (typeof(Raven) != "undefined" && Raven.setUserContext) {
  86. Raven.setUserContext({email: '#{user.email}'});
  87. }