Merge pull request +7368 from c9/raygun

add a way to group raygun errors with parametrized messages
pull/43/merge
Lennart Kats 2015-05-17 19:26:58 +02:00
commit d822cd5457
2 zmienionych plików z 31 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;

Wyświetl plik

@ -67,6 +67,8 @@ define(function(require, exports, module) {
console.error(exception);
if (customData)
console.log(customData);
if (!exception.stack)
exception.stack = new Error().stack;
Raygun.send(exception, customData, tags);
}