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

onError blocked from running if releaseStage not in enabledReleaseStages #1518

Merged

Conversation

matthewjhowells
Copy link
Contributor

Goal

Modify BugSnag cocoa so that onError blocks will not run/be applied if releaseStage not in enabledReleaseStages. 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 the notifyInternal method. This was done by printing the event objects metadata to the console to check whether metadata from the onError callback had been applied yet.

Changeset

The relevant try catch block has been nested inside an if else statement.

The if statement checks if enabledReleaseStages contains releaseStage (based on values in self.configuration), allowing the callback try catch block to run if it does. If not, the try catch block is skipped, and bsg_log_info is used to print print an info message to the console.

Testing

This has been tested manually by modifying the releaseStage and enabledReleaseStages in the Bugsnag configuration. From manual testing this works fine.

I am currently trying to work out how creating new automatic tests works.

@github-actions
Copy link

github-actions bot commented Jan 19, 2023

Bugsnag.framework binary size did not change - 706,696 bytes

    FILE SIZE        VM SIZE    
 --------------  -------------- 
  +0.1%    +140  +0.1%    +140    __TEXT,__text
  +0.5%     +88  +0.5%     +88    __TEXT,__cstring
  +0.2%     +32  +0.2%     +32    __DATA,__cfstring
  -0.4%     -32  -0.2%     -32    [__DATA]
  -0.9%    -228  -0.9%    -228    [__TEXT]
  [ = ]       0  [ = ]       0    TOTAL

Generated by 🚫 Danger

@matthewjhowells matthewjhowells changed the base branch from master to next January 25, 2023 17:05
@matthewjhowells matthewjhowells force-pushed the PLAT-8385-stopping-onError-based-on-release-stages branch from d71a136 to fb1d88f Compare January 27, 2023 11:14
@matthewjhowells matthewjhowells changed the title PLAT-8385 onError blocked from running if releaseStage not in enabledReleaseStages onError blocked from running if releaseStage not in enabledReleaseStages Jan 27, 2023
@matthewjhowells matthewjhowells marked this pull request as ready for review January 27, 2023 13:19
fixing build error

onError will run when NO enabledReleaseStage set

Refactoring releaseStage check

Updated changelog
@matthewjhowells matthewjhowells force-pushed the PLAT-8385-stopping-onError-based-on-release-stages branch from fb1d88f to 4c356ab Compare February 1, 2023 09:03
@matthewjhowells matthewjhowells merged commit 847749e into next Feb 1, 2023
@matthewjhowells matthewjhowells deleted the PLAT-8385-stopping-onError-based-on-release-stages branch February 1, 2023 13:30
@kstenerud kstenerud mentioned this pull request Mar 8, 2023
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.

3 participants