diff --git a/CHANGELOG.md b/CHANGELOG.md index ff4043ff0..28048023c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,9 @@ Bugsnag Notifiers on other platforms. ## Enhancements +* Add `unhandledRejections` to `BugsnagErrorTypes` + [#567](https://github.com/bugsnag/bugsnag-cocoa/pull/567) + * Rename `Bugsnag` start methods [#566](https://github.com/bugsnag/bugsnag-cocoa/pull/566) diff --git a/Source/BugsnagErrorTypes.h b/Source/BugsnagErrorTypes.h index 46a910413..8304ef399 100644 --- a/Source/BugsnagErrorTypes.h +++ b/Source/BugsnagErrorTypes.h @@ -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 diff --git a/Source/BugsnagErrorTypes.m b/Source/BugsnagErrorTypes.m index 21fa67e4e..e7bd60c58 100644 --- a/Source/BugsnagErrorTypes.m +++ b/Source/BugsnagErrorTypes.m @@ -16,6 +16,7 @@ - (instancetype)init { _signals = true; _cppExceptions = true; _machExceptions = true; + _unhandledRejections = true; #if DEBUG _ooms = false; diff --git a/Tests/BugsnagConfigurationTests.m b/Tests/BugsnagConfigurationTests.m index d03966ae6..88b9140a7 100644 --- a/Tests/BugsnagConfigurationTests.m +++ b/Tests/BugsnagConfigurationTests.m @@ -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); }