-
-
Notifications
You must be signed in to change notification settings - Fork 135
Ignore Errors does not working #436
Comments
Can you please provide an event that should but is not matching this errors filter? You can gather them using Raven.config('__DSN__', {
dataCallback: function (event) {
console.log(JSON.stringify(event, null, 2));
}
}) Cheers! |
I don't think the I too would prefer support for |
Aaaaaghr... I again misread that its raven-js issue. @eladhaz05 for now, please use @adamchainz I totally agree. We are in the process of unifying all JS SDKs and it soon won't be an issue. It'll take a while, but we'll get there soon :) |
you @'d the wrong adam |
Haha, sorry @adamchainz! And thanks for letting me know 🤦♂️ |
Hah, similar names :) @kamilogorek great to hear, look forward to a unified SDK! |
I've written a custom helper for this based on code found in raven-js, you can use it to support Helper: /**
* Join an array of string/regex patterns into a single regex (adapted from raven-js)
*/
function joinRegex(patterns) {
//Initialize sources
const sources = [];
//Loop patterns
for (const pattern of patterns) {
//If it's a string, we need to escape it
if (typeof pattern === 'string') {
sources.push(pattern.replace(/([.*+?^=!:${}()|[\]/\\])/g, '\\$1'));
}
//If it's a regular expression already, we want to extract the source
else if (pattern && pattern.source) {
sources.push(pattern.source);
}
//Intentionally skip other cases
}
//Return combined regular expression
return new RegExp(sources.join('|'), 'i');
} Configuration converter: if (Array.isArray(cfg.ignoreErrors) && cfg.ignoreErrors.length > 0) {
const ignoreErrors = joinRegex(cfg.ignoreErrors);
cfg.shouldSendCallback = function(data) {
if (data.message && typeof data.message.match === 'function') {
return !data.message.match(ignoreErrors);
}
return true;
};
} This essentially defines a |
Do you want to request a feature or report a bug?
bug
Has someone had this problem before?
Yes
What is the current behavior?
I want to use ignoreErrors in the config.
I use it like this:
// setting up configuration.
Raven.config('https://' + SentryId.publicKey + ':' + SentryId.secretKey + '@' +
SentryId.host + '/' + SentryId.project,
{ // configuring extra contextual information for the installation.
name:XXXXX,
environment:XXXXXX,
tags:{api:XXXXXXX},
ignoreErrors:[
'BadRequestException:',
'NotFoundException',
'UnauthrizedException'
]
}
)
I still got this errors with those strings
What is the expected behavior?
To get errors without those strings
Thank you
The text was updated successfully, but these errors were encountered: