Integrating Sentry for JS error tracking
This commit is contained in:
parent
fac820aecd
commit
90253b69c9
@ -77,6 +77,11 @@ gulp.task('markup', 'Build markup into ./build directory.', ['webpack'], functio
|
||||
'gaPropertyId': process.env.GA_PROP
|
||||
});
|
||||
}
|
||||
if (process.env.SENTRY_KEY) {
|
||||
hbStream.data({
|
||||
'sentryKey': process.env.SENTRY_KEY
|
||||
});
|
||||
}
|
||||
return gulp.src(config.globs.templates)
|
||||
.pipe(frontMatter())
|
||||
.pipe(hbStream)
|
||||
|
@ -63,6 +63,8 @@
|
||||
<script type="text/html" id="svg-container-base">
|
||||
{{> "svg_template"}}
|
||||
</script>
|
||||
|
||||
{{> "sentry"}}
|
||||
{{/block}}
|
||||
</footer>
|
||||
|
||||
|
6
lib/partials/sentry.hbs
Normal file
6
lib/partials/sentry.hbs
Normal file
@ -0,0 +1,6 @@
|
||||
{{#if sentryKey}}
|
||||
<script src="https://cdn.ravenjs.com/3.17.0/raven.min.js" crossorigin="anonymous"></script>
|
||||
<script>
|
||||
Raven.config('{{{sentryKey}}}').install()
|
||||
</script>
|
||||
{{/if}}
|
@ -11,20 +11,6 @@ import Parser from './parser/javascript.js';
|
||||
import _ from 'lodash';
|
||||
|
||||
(function() {
|
||||
// Global error handler that will send unhandled JavaScript exceptions and
|
||||
// stack-traces to Google Analytics. This data can be used to find errors in
|
||||
// code that were not found during testing.
|
||||
window.addEventListener('error', function(error) {
|
||||
if (error.lineno !== 0) {
|
||||
util.track('send', 'event', 'global', 'exception',
|
||||
`${error.filename}(${error.lineno},${error.colno}): ${error.message}`);
|
||||
|
||||
if (typeof error.error !== 'undefined' && typeof error.error.stack !== 'undefined') {
|
||||
util.track('send', 'event', 'global', 'stack trace', error.error.stack);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Initialize the main page of the site. Functionality is kept in the
|
||||
// [Regexper class](./regexper.html).
|
||||
if (document.body.querySelector('#content .application')) {
|
||||
|
Loading…
Reference in New Issue
Block a user