Adjusting how errors are logged
This should allow for working out any JS failures that may occur
This commit is contained in:
@@ -3,7 +3,20 @@ import Regexper from './regexper.js';
|
||||
import Parser from './parser/javascript.js';
|
||||
import _ from 'lodash';
|
||||
|
||||
window._gaq = (typeof _gaq !== 'undefined') ? _gaq : {
|
||||
push: console.debug.bind(console)
|
||||
};
|
||||
|
||||
(function() {
|
||||
window.addEventListener('error', function(error) {
|
||||
_gaq.push([
|
||||
'_trackEvent',
|
||||
'global',
|
||||
'exception',
|
||||
`${error.filename}(${error.lineno}): ${error.message}`
|
||||
]);
|
||||
});
|
||||
|
||||
if (document.body.querySelector('#content .application')) {
|
||||
var regexper = new Regexper(document.body);
|
||||
|
||||
|
||||
+3
-4
@@ -15,8 +15,6 @@ export default class Regexper {
|
||||
this.percentage = root.querySelector('#progress div');
|
||||
this.svgContainer = root.querySelector('#regexp-render');
|
||||
this.svgBase = this.root.querySelector('#svg-base').innerHTML;
|
||||
|
||||
this.gaq = (typeof window._gaq === 'undefined') ? [] : window._gaq;
|
||||
}
|
||||
|
||||
keypressListener(event) {
|
||||
@@ -79,7 +77,7 @@ export default class Regexper {
|
||||
}
|
||||
|
||||
_trackEvent(category, action) {
|
||||
this.gaq.push(['_trackEvent', category, action]);
|
||||
window._gaq.push(['_trackEvent', category, action]);
|
||||
}
|
||||
|
||||
set state(state) {
|
||||
@@ -169,8 +167,9 @@ export default class Regexper {
|
||||
if (message === 'Render cancelled') {
|
||||
this._trackEvent('visualization', 'cancelled');
|
||||
this.state = '';
|
||||
} else if (message.parseError) {
|
||||
this._trackEvent('visualization', 'parse error');
|
||||
} else {
|
||||
this._trackEvent('visualization', (message.parseError ? 'parse error' : 'exception'));
|
||||
throw message;
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user