Please forgive my ignorant question in advance. I’m just trying to learn Sentry a little, so we can leverage it most efficiently.
Just curious, what is the benefit in reporting the error here (https://github.com/getsentry/raven-js/blob/d20940823e380f1e0672433b197f9944d61afeb3/dist/raven.js#L366) and not just re-throwing it.
This way either traceKitWindowOnError() will report it if collectWindowErrors
is set to ‘true’ or user defined onerror handler can deal with it.
We have a custom onerror handler that checks for common noisy errors from browser plugins/extensions and 3rd party vendors. We set collectWindowErrors
to false and only send to sentry what is actionable. Unfortunately, everything that was wrapped via _instrumentTryCatch() via install() still gets sent to Sentry.
Maybe our setup is not optimal and we are trying to fit a square peg into a round hole, but still just curious.
EDIT: Nevermind, I misunderstood this (https://blog.sentry.io/2016/01/04/client-javascript-reporting-window-onerror.html) article originally. For some reason, I thought that if you wrap in try/catch and rethrown, the 5th argument in onerror handler will magically appear (on older browsers like safari9).