Skip to content

Switched to using callback for determining if error should be sent - #314

Closed
juriejan wants to merge 1 commit into
getsentry:masterfrom
juriejan:should-send-callback
Closed

juriejan wants to merge 1 commit into
getsentry:masterfrom
juriejan:should-send-callback

Conversation

@juriejan

@juriejan juriejan commented Feb 3, 2015

Copy link
Copy Markdown
Contributor

Not sure if this would be useful to anyone else, but I required the use of a callback function after determining if I'd like an error to be sent to the Sentry platform.

I've just implemented this a basic as possible, as I didn't have much time to look around and see how this project tends to implement similar patterns. So some guidance would be appreciated.

@juriejan juriejan closed this Feb 3, 2015
@juriejan juriejan reopened this Feb 3, 2015
@mattrobenolt

Copy link
Copy Markdown
Contributor

You need to revert that change where you re-compiled a distribution. That makes this really hard to review. See: https://raven-js.readthedocs.org/en/latest/contributing/index.html#contributing-back-code

What problem is this trying to solve that shouldSendCallback can't solve already?

@juriejan
juriejan force-pushed the should-send-callback branch from d5620aa to dcd1f4c Compare February 3, 2015 09:52
@juriejan

juriejan commented Feb 3, 2015

Copy link
Copy Markdown
Contributor Author

I've rolled back and created a single commit without compiling the distribution.

I'm currently using this in a mobile application (Cordova based) and I'd like to display a dialog to users where they can confirm that an error report should be sent. The callback allows me to respond after they have made their selection.

@mattrobenolt

Copy link
Copy Markdown
Contributor

So the problem that we have with this is it breaks backwards compatibility. The API of shouldSendCallback has now changed.

I'm not opposed to this change in general, but I don't want to break existing installations.

The normal use case is what we actually document:

    shouldSendCallback: function(data) {
        // only send 10% of errors
        var sampleRate = 10;
        return (Math.random() * 100 <= sampleRate);
    }

And this change breaks that.

@benvinegar

Copy link
Copy Markdown
Contributor

It's been 2 years, nobody else has advocated for this change here, and we're probably going to change the API soon anyways. Closing.

@benvinegar benvinegar closed this Mar 23, 2017
pull Bot pushed a commit to TheDegenerateDev5150/sentry-javascript that referenced this pull request Jun 19, 2026
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

Successfully merging this pull request may close these issues.

3 participants