add a way to group raygun errors with parametrized messages

pull/43/merge
nightwing 2015-05-16 02:24:18 +04:00
rodzic 0f75645437
commit 2f55e03b36
1 zmienionych plików z 29 dodań i 0 usunięć

Wyświetl plik

@ -1422,6 +1422,19 @@ window.TraceKit = TraceKit;
'Script error.': {},
'DealPly is not defined': { factor: 10e5 }
};
var groupedErrors = [{
regex: /^((?:Project|User) with id ')(\d+)(' does not exist)/i,
pullOut: { 1: 'id' }
}, {
regex: /^(Failed to execute 'send' on 'XMLHttpRequest': Failed to load)([\s\S]*)/i,
pullOut: { 1: 'url' }
}, {
regex: /^(Cannot GET \/)([\s\S]*)/i,
pullOut: { 1: 'url' }
}, {
regex: /^(Error whilst parsing: Unexpected end whilst parsing xpath \/)([\s\S]*)/i,
pullOut: { 1: 'apfStuff' }
}];
function processUnhandledException(stackTrace, options) {
var stack = [],
qs = {};
@ -1477,6 +1490,22 @@ window.TraceKit = TraceKit;
// c9!
var message = custom_message || stackTrace.message || options.status || 'Error with empty message';
groupedErrors.some(function(g) {
if (g.regex.test(message)) {
var parts = message.split(g.regex);
message = "";
parts.forEach(function(p, i) {
if (g.pullOut[i - 1]) {
finalCustomData[g.pullOut[i - 1]] = p;
} else {
message += p;
}
});
return true;
}
});
if (blackListedErrors.hasOwnProperty(message)) {
var count = (blackListedErrors[message].count || 0) + 1;
blackListedErrors[message].count = count;