Skip to content

SentryReplayOptions.BeforeErrorSamplingCallback not firing when there is no exception attached #5893

Description

@cpaleop

Integration

sentry-android

Build System

Gradle

AGP Version

9.3.1

Proguard

Enabled

Other Error Monitoring Solution

Firebase Crashlytics

Version

8.50.1

Steps to Reproduce

When capturing an event with ERROR level but without an Exception attached, the SentryReplayOptions.BeforeErrorSamplingCallback is not firing.

Assistance from an LLM pointed that the logic in SentryClient.captureEvent() requires the event to have at least one exception attached for this callback to be fired.

I'm more interested to know if that's intended or not. We have valid usecases where we want to capture custom error events and filter them for error-session-replays (via SentryReplayOptions.BeforeErrorSamplingCallback as your docs suggest), but we are forced to attach an Exception to the event in order to achieve this.

FYI we are using SentryTimberIntegration.

Expected Result

The SentryReplayOptions.BeforeErrorSamplingCallback to fire regardless if there is an exception attached or not.

Actual Result

SentryReplayOptions.BeforeErrorSamplingCallback is not firing unless there is an Exception attached

Metadata

Metadata

Assignees

No one assigned

    Projects

    Status
    Waiting for: Product Owner

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions