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-5412] Add BugsnagStackframe.type #902

Merged
merged 1 commit into from
Nov 23, 2020
Merged

Conversation

nickdowell
Copy link
Contributor

@nickdowell nickdowell commented Nov 23, 2020

Goal

Adding type to BugsnagStackframe is a prerequisite for supporting mixed stack traces containing multiple languages.

Design

The type parameter is intended to be nil in most cases, and only set if the stack trace contains more than one language - e.g. a reactnativejs exception that contains some cocoa frames.

Because the existing BSGErrorType is an int-based enum and cannot naturally represent a nil value, a new Objective-C style string enum BugsnagStackframeType has been created specifically for this property.

In a future notifier update when we are making breaking API changes, we should consider switching all our enums that are serialized as strings to NS_TYPED_ENUMs.

Changeset

  • Added type parameter
  • Added BugsnagStackframe+Private.h to remove duplicate declarations
  • Adopted NS_ASSUME_NONNULL for stack frame header

Testing

  • Implemented unit tests to validate expected behaviour of type parameter
  • Manually verified using a customised version of BugsnagReactNative


typedef NSString * BugsnagStackframeType NS_TYPED_ENUM;

FOUNDATION_EXPORT BugsnagStackframeType const BugsnagStackframeTypeCocoa;
Copy link
Contributor

Choose a reason for hiding this comment

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

Would we also need enum values for react-native and other frameworks on top of ios?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No - this exists only so that BugsnagReactNative can set the type of native stack frames. The reactnativejs type is applied to the containing error, which specifies the type for all frames that don't explicitly state a type.

@nickdowell nickdowell merged commit 6ce1630 into next Nov 23, 2020
@nickdowell nickdowell deleted the nickdowell/stackframe-type branch November 23, 2020 16:57
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.

4 participants