Для тех, у кого есть точная проблема, я изменил ответ Бретта так, чтобы он проверял всю трассировку стека, так как причину исключения иногда можно спрятать в Android.
SentryClient client = Sentry.getStoredClient();
client.addShouldSendEventCallback(new ShouldSendEventCallback() {
@Override
public boolean shouldSend(Event event) {
for (Map.Entry<String, SentryInterface> interfaceEntry : event.getSentryInterfaces().entrySet()) {
if (interfaceEntry.getValue() instanceof ExceptionInterface) {
ExceptionInterface i = (ExceptionInterface) interfaceEntry.getValue();
for (SentryException sentryException : i.getExceptions()) {
for (SentryStackTraceElement element : sentryException.getStackTraceInterface().getStackTrace()) {
if (element.getModule().contains("com.example.library")) {
return true;
}
}
}
}
}
return false;
}
});