remove circular references when reporting to sentry

This commit is contained in:
Brian Gough 2015-03-03 16:41:21 +00:00
parent 0ff5f54bf6
commit edc83b905c

View file

@ -107,6 +107,12 @@ html(itemscope, itemtype='http://schema.org/Product')
// only send a fraction of errors
var sampleRate = 1.00;
return (Math.random() <= sampleRate);
},
dataCallback: function(data) {
// remove circular references from object
var cache = [];
var s = JSON.stringify(data, function(k, v) { if (typeof v === 'object' && v !== null) { if (cache.indexOf(v) !== -1) return "[circular]"; cache.push(v); }; return v; });
return JSON.parse(s);
}
// we highly recommend restricting exceptions to a domain in order to filter out clutter
// whitelistUrls: ['example.com/scripts/']