Adjusting how JS errors are tracked.
- Checking for a valid lineno instead of the filename to filter out "(0): Script error." logging - Tracking stack traces separately from exceptions to make debugging easier
This commit is contained in:
parent
0600d18bb5
commit
66c9d445da
@ -9,20 +9,22 @@ window._gaq = (typeof _gaq !== 'undefined') ? _gaq : {
|
|||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
window.addEventListener('error', function(error) {
|
window.addEventListener('error', function(error) {
|
||||||
if (typeof error.error !== 'undefined' && typeof error.error.stack !== 'undefined') {
|
if (error.lineno !== 0) {
|
||||||
_gaq.push([
|
|
||||||
'_trackEvent',
|
|
||||||
'global',
|
|
||||||
'exception',
|
|
||||||
error.error.stack
|
|
||||||
]);
|
|
||||||
} else if (error.filename !== '') {
|
|
||||||
_gaq.push([
|
_gaq.push([
|
||||||
'_trackEvent',
|
'_trackEvent',
|
||||||
'global',
|
'global',
|
||||||
'exception',
|
'exception',
|
||||||
`${error.filename}(${error.lineno},${error.colno}): ${error.message}`
|
`${error.filename}(${error.lineno},${error.colno}): ${error.message}`
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
if (typeof error.error !== 'undefined' && typeof error.error.stack !== 'undefined') {
|
||||||
|
_gaq.push([
|
||||||
|
'_trackEvent',
|
||||||
|
'global',
|
||||||
|
'stack trace',
|
||||||
|
error.error.stack
|
||||||
|
]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user