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

Add unhandledRejections to BugsnagErrorTypes #567

Merged
merged 2 commits into from
Apr 29, 2020
Merged
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
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 `Bugsnag` start methods
[#566](https://github.com/bugsnag/bugsnag-cocoa/pull/566)

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