make sure we do not flood raygun with errors

pull/248/head
nightwing 2016-01-29 18:43:26 +04:00
rodzic 803c4ccf4a
commit 29d1e1da17
1 zmienionych plików z 15 dodań i 11 usunięć

Wyświetl plik

@ -1419,12 +1419,13 @@ window.TraceKit = TraceKit;
}
var blackListedErrors = {
'Error with empty message': {},
'Script error.': {},
'DealPly is not defined': { factor: 10e5 },
"Cannot read property 'style' of null": { factor: 10e3 },
"Project with id '<id>' does not exist": { factor: 10e2 },
"Workspace not found": { factor: 10e2 },
count: 0,
'#Error with empty message': {},
'#Script error.': {},
'#DealPly is not defined': { factor: 10e5 },
"#Cannot read property 'style' of null": { factor: 10e3 },
"#Project with id '<id>' does not exist": { factor: 10e2 },
"#Workspace not found": { factor: 10e2 },
};
var groupedErrors = [{
regex: /^((?:Project|User) with id ')(\d+)(' does not exist)/i,
@ -1511,13 +1512,16 @@ window.TraceKit = TraceKit;
}
});
if (blackListedErrors.hasOwnProperty(message)) {
var count = (blackListedErrors[message].count || 0) + 1;
blackListedErrors[message].count = count;
if (count % (blackListedErrors[message].factor || 10) !== 1) {
var blackListEntry = blackListedErrors["#" + message];
if (blackListEntry) {
var count = (blackListEntry.count || 0) + 1;
blackListEntry.count = count;
if (count % (blackListEntry.factor || 10) !== 1) {
return;
}
finalCustomData.$blackList = blackListedErrors[message];
finalCustomData.$blackList = blackListEntry;
} else if (blackListedErrors.count < 10000) {
blackListedErrors["#" + message] = {};
}
var payload = {