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 3020c28
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 1 deletion.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ Bugsnag Notifiers on other platforms.

## Enhancements

* Add `unhandledRejections` to `BugsnagErrorTypes`
[#567](https://github.com/bugsnag/bugsnag-cocoa/pull/567)

* Rename `OnSend` to `OnSendError`
[#562](https://github.com/bugsnag/bugsnag-cocoa/pull/562)

Expand Down
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 3020c28

Please sign in to comment.