Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PLAT-5129 ] Fix reporting of user events with multiple errors #821

Merged
merged 1 commit into from
Sep 25, 2020

Conversation

nickdowell
Copy link
Contributor

Goal

This change is necessary for the correct reporting of native module promise rejections from react native.

Although the crash reports received by the Cocoa notifier and stored to disk contained the native stack trace, the reports sent to the back-end were missing the native error.

Changeset

-[BugsnagEvent toJson] was ignoring the errors array if user.overrides.customStacktraceFrames and user.overrides.customStacktraceType were set in the payload, which is the case for RN native promise rejections.

This was not a problem when events were only expected to have a single error, but RN native promise rejections may have a second error that represents the native stack.

This change ensures the customException only overrides the first error, leaving the native one alone.

Testing

I pushed a version of this code to bugsnag-js in order to see the effect on the e2e tests. This change allowed Scenario: Handled JS error with native stacktrace to pass the And the payload field "events.0.exceptions" is an array with 2 elements check and several others, although changes to the scenario will be required to cater for the platform-specific format of Cocoa crash reports - https://buildkite.com/bugsnag/at-bugsnag-react-native/builds/796#36f69338-2aaf-4436-a5f1-563642c3a4f1/458

A unit test case was added to this project, which fails without the change to -[BugsnagEvent toJson] but passes with it.

@nickdowell nickdowell changed the title Fix reporting of user events with multiple errors [PLAT-5129 ] Fix reporting of user events with multiple errors Sep 24, 2020
@nickdowell nickdowell force-pushed the 5129-fix-user-events-with-multiple-errors branch from efb6120 to c335afd Compare September 24, 2020 15:11
Copy link
Contributor

@fractalwrench fractalwrench left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@nickdowell nickdowell merged commit 079cdfb into next Sep 25, 2020
@nickdowell nickdowell deleted the 5129-fix-user-events-with-multiple-errors branch September 25, 2020 08:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants