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 the output for unhandled errors #3977

Merged
merged 3 commits into from
Jun 4, 2024
Merged

Conversation

gonzaloriestra
Copy link
Contributor

WHY are these changes introduced?

Unhandled errors are shown twice:

Monosnap -zsh 2024-06-04 13-31-48

WHAT is this pull request doing?

  • Sets the flag skipOclifErrorHandling to prevent Oclif from printing the error, which is already shown by the CLI
  • Skips the stacktrace for API errors, which is not useful (it always points to the code where the request is made)

How to test your changes?

  • Edit packages/cli/src/cli/commands/version.ts and add throw new Error('Boom!') at the beginning of run()
  • p shopify version

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
  • I've made sure that any changes to dev or deploy have been reflected in the internal flowchart.

Copy link
Contributor

github-actions bot commented Jun 4, 2024

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-management

Copy link
Contributor

github-actions bot commented Jun 4, 2024

Coverage report

St.
Category Percentage Covered / Total
🟡 Statements
71.92% (-0.02% 🔻)
7236/10061
🟡 Branches
69.06% (-0.02% 🔻)
3565/5162
🟡 Functions 71.57% 1936/2705
🟡 Lines
73.19% (-0.03% 🔻)
6813/9309
Show files with reduced coverage 🔻
St.
File Statements Branches Functions Lines
🟡
... / headers.ts
77.27% (-3.68% 🔻)
87.5% 77.78%
76.19% (-3.81% 🔻)
🟢
... / ConcurrentOutput.tsx
98.36% (-1.64% 🔻)
88.89% (-5.56% 🔻)
100%
98.31% (-1.69% 🔻)
🟢
... / base-command.ts
84.21% (-1.12% 🔻)
81.25% 77.27%
84.85% (-1.31% 🔻)

Test suite run success

1684 tests passing in 781 suites.

Report generated by 🧪jest coverage report action from 08b6acc

@gonzaloriestra gonzaloriestra marked this pull request as ready for review June 4, 2024 11:49

This comment has been minimized.

Copy link
Contributor

github-actions bot commented Jun 4, 2024

Differences in type declarations

We detected differences in the type declarations generated by Typescript for this branch compared to the baseline ('main' branch). Please, review them to ensure they are backward-compatible. Here are some important things to keep in mind:

  • Some seemingly private modules might be re-exported through public modules.
  • If the branch is behind main you might see odd diffs, rebase main into this branch.

New type declarations

We found no new type declarations in this PR

Existing type declarations

packages/cli-kit/dist/public/node/base-command.d.ts
@@ -5,7 +5,7 @@ declare abstract class BaseCommand extends Command {
     static analyticsNameOverride(): string | undefined;
     static analyticsStopCommand(): string | undefined;
     catch(error: Error & {
-        exitCode?: number | undefined;
+        skipOclifErrorHandling: boolean;
     }): Promise<void>;
     protected init(): Promise<any>;
     protected showNpmFlagWarning(): void;

@gonzaloriestra gonzaloriestra added this pull request to the merge queue Jun 4, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jun 4, 2024
@gonzaloriestra gonzaloriestra added this pull request to the merge queue Jun 4, 2024
Merged via the queue into main with commit 8f225ad Jun 4, 2024
@gonzaloriestra gonzaloriestra deleted the fix-unhandled-errors-output branch June 4, 2024 13:20
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