Skip to content

Commit

Permalink
feat: add unhandledRejections property
Browse files Browse the repository at this point in the history
  • Loading branch information
fractalwrench committed Apr 28, 2020
1 parent 7d28f40 commit 6904bcb
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
7 changes: 7 additions & 0 deletions Source/BugsnagErrorTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,12 @@
*/
@property BOOL machExceptions;

/**
* Sets whether Bugsnag should automatically capture and report unhandled promise rejections.
* This only applies to React Native apps.
* By default, this value is true.
*/
@property BOOL unhandledRejections;

@end

1 change: 1 addition & 0 deletions Source/BugsnagErrorTypes.m
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ - (instancetype)init {
_signals = true;
_cppExceptions = true;
_machExceptions = true;
_unhandledRejections = true;

#if DEBUG
_ooms = false;
Expand Down
5 changes: 4 additions & 1 deletion Tests/BugsnagConfigurationTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -706,17 +706,20 @@ -(void)testBSGErrorTypes {
XCTAssertTrue(config.enabledErrorTypes.cppExceptions);
XCTAssertTrue(config.enabledErrorTypes.unhandledExceptions);
XCTAssertTrue(config.enabledErrorTypes.machExceptions);

XCTAssertTrue(config.enabledErrorTypes.unhandledRejections);

// Test that we can set it
config.enabledErrorTypes.ooms = false;
config.enabledErrorTypes.signals = false;
config.enabledErrorTypes.cppExceptions = false;
config.enabledErrorTypes.unhandledExceptions = false;
config.enabledErrorTypes.unhandledRejections = false;
config.enabledErrorTypes.machExceptions = false;
XCTAssertFalse(config.enabledErrorTypes.ooms);
XCTAssertFalse(config.enabledErrorTypes.signals);
XCTAssertFalse(config.enabledErrorTypes.cppExceptions);
XCTAssertFalse(config.enabledErrorTypes.unhandledExceptions);
XCTAssertFalse(config.enabledErrorTypes.unhandledRejections);
XCTAssertFalse(config.enabledErrorTypes.machExceptions);
}

Expand Down

0 comments on commit 6904bcb

Please sign in to comment.