Description
We get a ton of exception noise in our logs that we don't have much control over. After some research, I think I've discovered a great chunk of this originates in window.unload.
If we could pass the arguments from the erroring function to processException, or if we had a preProcessException function, we could tag the exception with the event type. This would let us filter out garbage from window.unload events. I did a basic version of this in our Raven build, and we've seen a good drop so far.
I'd like to do this without modifying Tracekit, but here's what I changed on my end so far. I could do some more work on a proper patch, but I wanted to see if anyone had other thoughts.
TraceKit.wrap = function traceKitWrapper(func) {
function wrapped() {
try {
return func.apply(this, arguments);
} catch (e) {
if (e) { e._eventType = (arguments && arguments[0]) ? arguments[0].type : null; }
TraceKit.report(e);
throw e;
}
}
return wrapped;
};
and then modify window.onerror in Raven with something like:
if (lastException && (lastException._eventType == "unload")) {
return false;
}
Obviously this wouldn't be a great addition to the project as is, but has anyone else seen similar results?