Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

### Fixes

- Fix `_experiments.enableUnhandledCPPExceptionsV2` being silently ignored on iOS ([#6014](https://github.com/getsentry/sentry-react-native/pull/6014))
- Fix iOS UI profiling options being silently ignored ([#6012](https://github.com/getsentry/sentry-react-native/pull/6012))

### Dependencies
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1470,6 +1470,60 @@ - (void)testStartCreateOptionsWithDictionaryEmptyExperimentsDoesNotInstallConfig
}
#endif

- (void)testStartCreateOptionsWithDictionaryEnableUnhandledCPPExceptionsV2Enabled
{
NSError *error = nil;

NSDictionary *_Nonnull mockedReactNativeDictionary = @{
@"dsn" : @"https://abcd@efgh.ingest.sentry.io/123456",
@"_experiments" : @ {
@"enableUnhandledCPPExceptionsV2" : @YES,
},
};
SentryOptions *actualOptions =
[RNSentryStart createOptionsWithDictionary:mockedReactNativeDictionary error:&error];

XCTAssertNotNil(actualOptions, @"Did not create sentry options");
XCTAssertNil(error, @"Should not pass no error");
XCTAssertTrue(actualOptions.experimental.enableUnhandledCPPExceptionsV2,
@"enableUnhandledCPPExceptionsV2 should be enabled");
}

- (void)testStartCreateOptionsWithDictionaryEnableUnhandledCPPExceptionsV2Disabled
{
NSError *error = nil;

NSDictionary *_Nonnull mockedReactNativeDictionary = @{
@"dsn" : @"https://abcd@efgh.ingest.sentry.io/123456",
@"_experiments" : @ {
@"enableUnhandledCPPExceptionsV2" : @NO,
},
};
SentryOptions *actualOptions =
[RNSentryStart createOptionsWithDictionary:mockedReactNativeDictionary error:&error];

XCTAssertNotNil(actualOptions, @"Did not create sentry options");
XCTAssertNil(error, @"Should not pass no error");
XCTAssertFalse(actualOptions.experimental.enableUnhandledCPPExceptionsV2,
@"enableUnhandledCPPExceptionsV2 should be disabled");
}

- (void)testStartCreateOptionsWithDictionaryEnableUnhandledCPPExceptionsV2Default
{
NSError *error = nil;

NSDictionary *_Nonnull mockedReactNativeDictionary = @{
@"dsn" : @"https://abcd@efgh.ingest.sentry.io/123456",
};
SentryOptions *actualOptions =
[RNSentryStart createOptionsWithDictionary:mockedReactNativeDictionary error:&error];

XCTAssertNotNil(actualOptions, @"Did not create sentry options");
XCTAssertNil(error, @"Should not pass no error");
XCTAssertFalse(actualOptions.experimental.enableUnhandledCPPExceptionsV2,
@"enableUnhandledCPPExceptionsV2 should default to disabled");
}

- (void)testStartEventFromSentryCocoaReactNativeHasOriginAndEnvironmentTags
{
SentryEvent *testEvent = [[SentryEvent alloc] init];
Expand Down
8 changes: 7 additions & 1 deletion packages/core/ios/RNSentryStart.m
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,15 @@ + (SentryOptions *_Nullable)createOptionsWithDictionary:(NSDictionary *_Nonnull)
}
}

// Configure iOS UI Profiling from _experiments.profilingOptions
// Configure experimental options from _experiments
NSDictionary *experiments = mutableOptions[@"_experiments"];
if (experiments != nil && [experiments isKindOfClass:[NSDictionary class]]) {
BOOL enableUnhandledCPPExceptions =
[experiments[@"enableUnhandledCPPExceptionsV2"] boolValue];
[RNSentryExperimentalOptions setEnableUnhandledCPPExceptionsV2:enableUnhandledCPPExceptions
sentryOptions:sentryOptions];

// Configure iOS UI Profiling
NSDictionary *profilingOptions = experiments[@"profilingOptions"];
if (profilingOptions != nil && [profilingOptions isKindOfClass:[NSDictionary class]]) {
[RNSentryExperimentalOptions configureProfilingWithOptions:profilingOptions
Expand Down
Loading