Skip to content

AggregateError error message is ignored during processing #62299

Open
@kamilogorek

Description

@kamilogorek

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which SDK are you using?

@sentry/browser

SDK Version

7.91.0

Framework Version

No response

Link to Sentry event

No response

SDK Setup

No response

Steps to Reproduce

function foo () {
  const rejections = [new Error('Message 1'), new Error('Message 2'), new Error('Message 3')]
  throw new AggregateError(rejections, 'wat')
}

try {
  foo()
} catch(e) {
  Sentry.captureException(e)
}

Expected Result

When creating a new AggregateError instance, it accepts an optional 2nd argument, which should be used as the error message per https://tc39.es/ecma262/multipage/fundamental-objects.html#sec-aggregate-error

Currently LinkedErrors will ignore that property and use the message from the first child instead.
In the case above, wat should be the message for the root error.

Actual Result

First child error is used as the source of the message.

image

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    Status

    No status

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions