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 shouldSendEvent callback #428

Merged
merged 5 commits into from
Jun 22, 2017
Merged

Conversation

HazAT
Copy link
Member

@HazAT HazAT commented Jun 22, 2017

This adds a shouldSendEvent callback the be able to prevent sending of specific events.
e.g.:

sentryClient.addShouldSendEvent(new ShouldSendEventCallback() {
            @Override
            public boolean shouldSend(Event event) {
                // We don't want to send events that are from ExceptionsManagerModule.
                // Because we sent it already from raven.
                if (event.getSentryInterfaces().containsKey(ExceptionInterface.EXCEPTION_INTERFACE)) {
                    ExceptionInterface exceptionInterface = ((ExceptionInterface)event.getSentryInterfaces().get(ExceptionInterface.EXCEPTION_INTERFACE));
                    if (exceptionInterface.getExceptions().getFirst().getExceptionClassName().contains("JavascriptException")) {
                        return false;
                    }
                }
                return true;
            }
        });

@HazAT HazAT self-assigned this Jun 22, 2017
@HazAT HazAT requested a review from bretthoerner June 22, 2017 07:21
Copy link

@bretthoerner bretthoerner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made it a private set of callbacks instead of a single static one, looks good to me now!

@bretthoerner bretthoerner merged commit d4842d1 into master Jun 22, 2017
@bretthoerner bretthoerner deleted the feature/shouldsendevent-callback branch June 22, 2017 19:25
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.

2 participants