Skip to content

Wrong explanation about the Exception Interface in docs. #8871

Closed
@bhargavcp

Description

@bhargavcp

Is there an existing issue for this?

How do you use Sentry?

Self-hosted/on-premise

Which SDK are you using?

@sentry/browser

SDK Version

7.57.0

Framework Version

7.57.0

Link to Sentry event

No response

SDK Setup

Sentry.init({
    dsn: <redacted>,
    integrations: integrations,
    release: `${$BUILD_FLAVOR}-${$REVISION}`,
    environment: $BUILD_FLAVOR,
    transport: (transportOptions: BrowserTransportOptions) =>
      makeFetchTransport(transportOptions, fetchImpl),
    maxBreadcrumbs: 100,
    sendClientReports: false,
    beforeSend: (event: Event, hint?: EventHint) => {
     <redacted>
     /**
      * Essentially, here if the event.exception.values[0] is of the type that we want to skip, we return null, 
      * otherwise we just return the event.
      */
    },
  });

Steps to Reproduce

Throw an error from a function (let's call it MessageRenderer) that returns React components based on certain conditions, and in one of the conditions it throws an error.
The return of this function is wrapped in sentry react's ErrorBoundary component.

Expected Result

When looking at the exception.values list in the event object in the beforeSend function, based on the docs (link: https://develop.sentry.dev/sdk/event-payloads/exception/), I was expecting the original error thrown from the function (MessageRenderer from my example above) to be present in the first index, followed by the ErrorBoundary error.

Actual Result

But, the first index (index 0) is taken up by the React ErrorBoundary Error object and the second index (index 1) contains the original thrown error. This is opposite of what is mentioned in the docs.

Am I missing something or is Error Boundary a unique case where this is not true?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Package: browserIssues related to the Sentry Browser SDK

    Type

    No type

    Projects

    Status

    Waiting for: Product Owner

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions