onError blocked from running if releaseStage not in enabledReleaseStages #1518
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Goal
Modify BugSnag cocoa so that onError blocks will not run/be applied if
releaseStage
not inenabledReleaseStages
. This is to bring BugSnag cocoas functionality in to line with the products specifications.Design
I tested at which point
BugsnagClient.m
runs onError callbacks (defined at Bugsnag.notify), identifying this as a part of thenotifyInternal
method. This was done by printing theevent
objects metadata to the console to check whether metadata from theonError
callback had been applied yet.Changeset
The relevant
try catch
block has been nested inside anif else
statement.The
if
statement checks ifenabledReleaseStages
containsreleaseStage
(based on values in self.configuration), allowing the callbacktry catch
block to run if it does. If not, thetry catch
block is skipped, andbsg_log_info
is used to print print an info message to the console.Testing
This has been tested manually by modifying the
releaseStage
andenabledReleaseStages
in the Bugsnag configuration. From manual testing this works fine.I am currently trying to work out how creating new automatic tests works.