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

Create structured BugsnagError class #533

Merged
merged 5 commits into from
Apr 21, 2020
Merged

Conversation

fractalwrench
Copy link
Contributor

Goal

Converts event.errors from an NSDictionary to a structured class where each field is represented as a property.

BugsnagError represents a single error that caused the event, and contains the error class/message/type/stacktrace.

Changeset

  • Added BugsnagError class with properties for each field in the spec
  • Altered BugsnagEvent to use readonly NSArray<BugsnagError *>
  • Refactored JSON serialization logic into BugsnagError
  • Added BSGErrorType to represent errors. Note that this requires the rename of configuration.enabledErrorTypes to BSGEnabledErrorType to prevent a symbol clash
  • Removed errorClass and errorMessage from BugsnagEvent

Tests

  • Added unit test to verify that BugsnagError populates correctly, and that it serializes JSON correctly
  • Added missing unit test coverage for error class/message parsing
  • Updated existing test coverage

@fractalwrench fractalwrench changed the title Replace NSDictionary with structured BugsnagError class Create structured BugsnagError class Apr 9, 2020
@fractalwrench fractalwrench force-pushed the v6-structured-error-class branch from b033dc7 to 168f49b Compare April 9, 2020 15:03
@fractalwrench fractalwrench marked this pull request as ready for review April 9, 2020 16:19
@fractalwrench fractalwrench force-pushed the v6-structured-error-class branch from 168f49b to 58f5def Compare April 9, 2020 16:19
@fractalwrench fractalwrench marked this pull request as draft April 14, 2020 08:44
@fractalwrench fractalwrench removed the request for review from robinmacharg April 15, 2020 14:18
@fractalwrench fractalwrench force-pushed the v6-structured-error-class branch from 58f5def to 176033f Compare April 16, 2020 11:22
@fractalwrench fractalwrench marked this pull request as ready for review April 16, 2020 14:44
CHANGELOG.md Outdated
@@ -23,6 +23,12 @@ Bugsnag Notifiers on other platforms.
* Add `originalError` property to `BugsnagEvent`
[#541](https://github.com/bugsnag/bugsnag-cocoa/pull/541)

* Remove attachCustomStacktrace from public API
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: attachCustomStacktrace formatting.

Copy link
Contributor

@robinmacharg robinmacharg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! One very minor nit, approved on that basis.

@fractalwrench fractalwrench merged commit 8d6d526 into v6 Apr 21, 2020
@fractalwrench fractalwrench deleted the v6-structured-error-class branch April 21, 2020 12:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants