Skip to content

When multiple errors are caught, the wrong one is used for mechanism and description #10851

@lobsterkatie

Description

@lobsterkatie

While I was working on #10850, which fixes a problem where we consider the wrong error in a chain of linked errors when it comes to the titling and grouping of events, I discovered two other places where we seem to be focusing on the wrong error when multiple errors are caught. Just as with grouping and titling, it makes sense to use the error which was actually caught both when assigning mechanism data and when describing the event in log messages. That error generally ends up being the last entry in the event.exception.values array, but in both cases we've been using the first entry. (See both addExceptionMechanism and getEventDiscription in misc.ts from @sentry/utils.)

(We also use the first exception in addExceptionTypeValue in the same file, though in that case it's less clear to me that it's an issue. Given that that function is designed to be used with synthetic exceptions, I'm not sure it matters. Would we ever have multiple exception.values entries at the same time as we're using a synthetic exception?)

The simplest fix for these problems is to just use the last entry in the array rather than the first entry (and I have code which does that which I can PR), but perhaps we want to differentiate between aggregate errors and linked errors just as we do in #10850?

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions