sentry-java icon indicating copy to clipboard operation
sentry-java copied to clipboard

Some callbacks do not have their Exceptions caught yet

Open adinauer opened this issue 3 years ago • 2 comments

Integration

sentry

Java Version

any

Version

6.1.2

Steps to Reproduce

There are multiple places where an Exception thrown by a callback is not caught.

  • SentryAndroid.init param Sentry.OptionsConfiguration<SentryAndroidOptions> configuration
  • Local scope callback for captureX methods with param ScopeCallback callback
  • ... there's probably more

Expected Result

Exceptions should be caught and we should downgrade gracefully (throw away an event, don't enable the SDK, ...).

Actual Result

Exceptions are not caught

adinauer avatar Jun 22 '22 05:06 adinauer

If we decide to throw away the event, we should ensure this information ends up in client reports.

philipphofmann avatar Jun 23 '22 15:06 philipphofmann

If we decide to throw away the event, we should ensure this information ends up in client reports.

Actually, it's the opposite, by swallowing the exception during eg beforeSend, we make sure that events get sent.

marandaneto avatar Jun 24 '22 06:06 marandaneto

Potential callbacks which should not crash: via Sentry

item has try/catch has logging note
init / OptionsConfiguration<T>.configure x x

via Hub

item has try/catch has logging note
withScope(..., ScopeCallback) x x
configureScope(..., ScopeCallback) x x
captureEvent(..., ScopeCallback) x x
captureMesssage(..., ScopeCallback) x x
captureException(..., ScopeCallback) x x

via SentryOptions

item has try/catch has logging note
BeforeSendCallback x x called by SentryClient.captureEvent
BeforeBreadcrumbCallback x x called by Scope.addBreadcrumb
TracesSamplerCallback x x called by TracesSampler.sample
ProfilesSamplerCallback x x called by TracesSampler.sample

Ignored for custom implementations of

  • Integration
  • ISentryClient
  • ILogger
  • IEnvelopeReader.read
  • IDebugImagesLoader
  • IEnvelopeCache
  • IEnvelopeReader
  • HostnameVerifier
  • SSLSocketFactory
  • ISerializer
  • ITransactionProfiler
  • ITransportFactory
  • ITransportGate
  • ISentryExecutorService
  • IScopeObserver
  • IClientReportRecorder

markushi avatar Oct 11 '22 08:10 markushi