[Theme] Handle async errors
WHY are these changes introduced?
Related to #4576 and #4598
A proper request retry + token refresh is still needed but this PR tries to handle async errors more gracefully.
WHAT is this pull request doing?
Ensure we print async errors properly with a red banner, and avoid process exit in some situations:
- On file delete / upload error in the remote theme, we show the error but the process continues. This is because the local development can continue working with local files in most cases, and is up to the developer to halt the process after seeing the error.
- On polling errors, wait for 5 errors before exiting the process. This is because it might recover from one or two failed attempts since it still compares local checksums with latest.
For example, when you lose your internet connection:
In the above, should we show only the first error in terminal instead of showing it 5 times?
How to test your changes?
Create fake errors around the modified code or directly disconnect your internet + reconnect it within 15 seconds.
Post-release steps
Measuring impact
How do we know this change was effective? Please choose one:
- [ ] n/a - this doesn't need measurement, e.g. a linting rule or a bug-fix
- [ ] Existing analytics will cater for this addition
- [ ] PR includes analytics changes to measure impact
Checklist
- [ ] I've considered possible cross-platform impacts (Mac, Linux, Windows)
- [ ] I've considered possible documentation changes
Thanks for your contribution!
Depending on what you are working on, you may want to request a review from a Shopify team:
- Themes: @shopify/advanced-edits
- UI extensions: @shopify/ui-extensions-cli
- Checkout UI extensions: @shopify/checkout-ui-extensions-api-stewardship
- Hydrogen: @shopify/hydrogen
- Other: @shopify/app-inner-loop
Coverage report
St.:grey_question: |
Category | Percentage | Covered / Total |
|---|---|---|---|
| π‘ | Statements | 72.73% (+0.09% πΌ) |
8563/11774 |
| π‘ | Branches | 69.72% (+0.11% πΌ) |
4205/6031 |
| π‘ | Functions | 71.69% (-0.03% π») |
2211/3084 |
| π‘ | Lines | 73.06% (+0.09% πΌ) |
8105/11094 |
Show new covered files π£
St.:grey_question: |
File | Statements | Branches | Functions | Lines |
|---|---|---|---|---|---|
| π’ | ... / function-upload-url-generate.ts |
100% | 100% | 100% | 100% |
Show files with reduced coverage π»
St.:grey_question: |
File | Statements | Branches | Functions | Lines |
|---|---|---|---|---|---|
| π’ | ... / app.test-data.ts |
91.4% (-0.54% π») |
91.09% (-0.09% π») |
81.01% (-1.27% π») |
90.8% (-0.57% π») |
| π’ | ... / app.ts |
87.07% | 70.89% (-0.72% π») |
92% | 88.37% |
| π’ | ... / specification.ts |
93.1% (-1.81% π») |
90.48% | 87.5% (-0.5% π») |
92% (-2.12% π») |
| π’ | ... / function.ts |
86.36% (-0.59% π») |
86.36% | 83.33% | 86.36% (-0.59% π») |
| π΄ | ... / extension.ts |
55.26% (-0.29% π») |
50% | 57.14% | 56.76% (-0.06% π») |
| π‘ | ... / update-extension.ts |
64.86% (-5.14% π») |
54.55% (-3.79% π») |
60% | 68.75% (-5.54% π») |
| π‘ | ... / build.ts |
74.49% | 59.09% (-2.27% π») |
75.76% | 72.22% |
| π’ | ... / extension.ts |
91.4% (+0.09% πΌ) |
73.58% | 91.3% (-0.36% π») |
91.21% (+0.1% πΌ) |
| π΄ | ... / app-management-client.ts |
20.75% (-0.09% π») |
10.26% | 22.58% (-0.25% π») |
19% (-0.09% π») |
| π΄ | ... / partners-client.ts |
26.87% (-0.2% π») |
40% | 18.18% (-0.34% π») |
26.56% (-0.21% π») |
| π‘ | ... / fs.ts |
62.5% | 84.62% (-7.05% π») |
58.97% | 62.5% |
Test suite run success
1947 tests passing in 876 suites.
Report generated by π§ͺjest coverage report action from 8e8fef2eebce91544f9f63db27c1e4dadcaf425d
We detected some changes at either packages/*/src or packages/cli-kit/assets/cli-ruby/** and there are no updates in the .changeset. If the changes are user-facing, run "pnpm changeset add" to track your changes and include them in the next release CHANGELOG.
@shopify/app-inner-loop, Could you please take a look at this PR? It seems like the merge is blocked by that requirement.