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() {
|
||||
window.addEventListener('error', function(error) {
|
||||
if (typeof error.error !== 'undefined' && typeof error.error.stack !== 'undefined') {
|
||||
_gaq.push([
|
||||
'_trackEvent',
|
||||
'global',
|
||||
'exception',
|
||||
error.error.stack
|
||||
]);
|
||||
} else if (error.filename !== '') {
|
||||
if (error.lineno !== 0) {
|
||||
_gaq.push([
|
||||
'_trackEvent',
|
||||
'global',
|
||||
'exception',
|
||||
`${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