Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add hook/callback/event to be fired when raven has reported an error to sentry #81

Closed
bisrael opened this issue Mar 11, 2013 · 8 comments

Comments

@bisrael
Copy link
Contributor

bisrael commented Mar 11, 2013

I've been trying to add custom error handling to sometimes reload a page when a particular type of error occurs, but I'd also like to report that through raven to sentry.

My current way of accomplishing this is by exposing the private TraceKit used by Raven through a Raven.TK variable.

This is sort of sub optimal, though, since TraceKit does all sorts of weird stuff if you're on IE, etc, and I'm not always guaranteed that my tracekit handler will be called before Raven's TK handler.

It also requires me to know that Raven uses TK and how TK works.

In reality, all I need to know is that Raven has caught an error, and successfully reported it Sentry, and also ideally the error it reported.

Then I could let Raven handle errors, report them, and when it's done, look at the error and try reloading.

Thanks.

@mattrobenolt
Copy link
Contributor

You want a callback for after the http request has been made, just to clarify? Right now, we just blindly fire and forget. :) The only reason I ask, is I'm not sure how hooking into TraceKit at all would satisfy this, since TraceKit isn't aware of us actually doing anything with the message.

@bisrael
Copy link
Contributor Author

bisrael commented Mar 11, 2013

That's my point, it doesnt really solve the problem.
I hooked into trace kit as a proxy for when raven has probably fired, since i hook in after raven.install, i should get called just after raven fires off the request, i also do a small timeout for good measure.

Ideally, we'd be notified whether the request failed or succeeded.
It would be nice to be able to retry failed requests.
Not sure how this would get accomplished since you use Image().src

TL;DR: yes.

@mattrobenolt
Copy link
Contributor

It'd be possible. Image objects have callbacks like, onload and onerror that I can hook up to. If anything, I'd literally just expose those for you.

@bisrael
Copy link
Contributor Author

bisrael commented Mar 11, 2013

That would be great.

@erikcw
Copy link

erikcw commented Mar 13, 2013

I agree. A callback mechanism would be very helpful. Please make it compatible with the "global" error handler. Maybe it could be passed into the Raven.config options object.

Raven.config('https://[email protected]/1').install()

@mattrobenolt
Copy link
Contributor

How about dispatching events instead? I'm more of a fan of events instead of callbacks.

@mattrobenolt
Copy link
Contributor

Something like:

Raven.config('...').install().addEventListener('logged', function() { });

@bisrael
Copy link
Contributor Author

bisrael commented Oct 22, 2014

searching the source of the current master repo says "yes"

Blake Israel

On Wed, Oct 22, 2014 at 1:58 AM, danse [email protected] wrote:

Uhm, i cannot find mention of this neither in the doc nor in the tests, is
this still supported?


Reply to this email directly or view it on GitHub
#81 (comment).

kamilogorek pushed a commit that referenced this issue Jun 12, 2018
Modified CoffeeScript example to use CoffeeScript
Lms24 pushed a commit that referenced this issue Jan 25, 2023
Fixes [CodeQL #81](https://github.com/getsentry/sentry-javascript/security/code-scanning/81). The `.replace()` originally here only replaced the first occurrence of double-backslashes. Using a regex with a global flag option ensures all of the `\\`'s are replaced with `/`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants