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

fix: cp-7.41.0 Handle better errors by getting tags in pre-init #13598

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

tommasini
Copy link
Contributor

Description

Handle errors in a more scalable way by adding a try catch to get tags function. Also added test coverage

Related issues

Fixes:

Manual testing steps

  1. Go to this page...

Screenshots/Recordings

Before

After

Pre-merge author checklist

Pre-merge reviewer checklist

  • I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
  • I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.

@tommasini tommasini added needs-dev-review PR needs reviews from other engineers (in order to receive required approvals) team-mobile-platform Mobile Platform team Run Smoke E2E Triggers smoke e2e on Bitrise labels Feb 18, 2025
@tommasini tommasini requested a review from a team as a code owner February 18, 2025 23:13
Copy link
Contributor

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

Copy link
Contributor

github-actions bot commented Feb 18, 2025

https://bitrise.io/ Bitrise

❌❌❌ pr_smoke_e2e_pipeline failed on Bitrise! ❌❌❌

Commit hash: 5fc8390
Build link: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/16abf2de-3675-4db6-a579-bf4ec104457c

Note

  • You can kick off another pr_smoke_e2e_pipeline on Bitrise by removing and re-applying the Run Smoke E2E label on the pull request

Tip

  • Check the documentation if you have any doubts on how to understand the failure on bitrise

Copy link
Member

@Gudahtt Gudahtt left a comment

Choose a reason for hiding this comment

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

Left a few suggestions.

Also, this broader try..catch will definitely solve the problem, but we could also consider splitting it up by selector or chunks of related selector. e.g. if unlocked is retrieved in a separate try..catch block, we might be able to retrieve that even before Engine initialization.

};
} catch (error) {
captureException(`Error getting tags: ${error}`);
return null;
Copy link
Member

Choose a reason for hiding this comment

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

It looks like this function returns tags if they're found, or undefined if they're not. Perhaps we can simplify this and not introduce a third return type? We should be able to use undefined here as well

return;
if (!state?.engine?.backgroundState?.ApprovalController) return;
try {
if (!state?.engine?.backgroundState?.AccountsController) return;
Copy link
Member

Choose a reason for hiding this comment

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

Nit: These early exits can be removed now as well, they were intended to guard against the same crashes we're now catching more broadly.

@tommasini
Copy link
Contributor Author

@Gudahtt Kept the optional chaining, but based on your comment I think this is in a much better state! Let me know your thoughts!

@tommasini tommasini added Run Smoke E2E Triggers smoke e2e on Bitrise and removed Run Smoke E2E Triggers smoke e2e on Bitrise labels Feb 20, 2025
Copy link
Contributor

github-actions bot commented Feb 20, 2025

https://bitrise.io/ Bitrise

❌❌❌ pr_smoke_e2e_pipeline failed on Bitrise! ❌❌❌

Commit hash: 01b88bd
Build link: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/c326b823-909c-4293-b884-8817a360c039

Note

  • You can kick off another pr_smoke_e2e_pipeline on Bitrise by removing and re-applying the Run Smoke E2E label on the pull request

Tip

  • Check the documentation if you have any doubts on how to understand the failure on bitrise

@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 62.66%. Comparing base (b5ea162) to head (01b88bd).
Report is 13 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #13598      +/-   ##
==========================================
+ Coverage   62.53%   62.66%   +0.13%     
==========================================
  Files        2005     2014       +9     
  Lines       44261    44353      +92     
  Branches     6006     6023      +17     
==========================================
+ Hits        27679    27796     +117     
+ Misses      14748    14726      -22     
+ Partials     1834     1831       -3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-dev-review PR needs reviews from other engineers (in order to receive required approvals) Run Smoke E2E Triggers smoke e2e on Bitrise team-mobile-platform Mobile Platform team
Projects
Status: Needs dev review
Development

Successfully merging this pull request may close these issues.

[Sentry] TypeError: undefined is not an object (evaluating 'n.flatMap')
3 participants