Skip to content

Internal ExceptionMechanismException type in SentryEvent #1201

@rkishchenko

Description

@rkishchenko

Spring Boot version 2.3.6. Sentry SDK version 3.2.0.

Implemented BeforeSendCallback to filter some exceptions from being forwarded to Sentry:

@Component
public class BeforeSendCallbackImpl implements BeforeSendCallback {

  @Override
  public SentryEvent execute(@NotNull SentryEvent event, @Nullable Object hint) {
    var eventThrowable = event.getThrowable();
    // ... some logic that deals with exception
    return event;
  }
}

The throwable object accessible from SentryEvent is ExceptionMechanismException wrapping the underlying exception thrown by the application. The ExceptionMechanismException is marked as @Internal though. There does not appear to be a way to access the underlying exception without peeking through internal class.

Metadata

Metadata

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions