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(cli): add try/catch block to create config file #763

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

maiieul
Copy link
Contributor

@maiieul maiieul commented May 24, 2024

What is it?

  • Feature / enhancement
  • Bug
  • Docs / tests
  • Other

Why is it needed?

Checklist:

  • My code follows the developer guidelines of this project
  • I have performed a self-review of my own code
  • I have ran pnpm change and documented my changes
  • I have add necessary docs (if needed)
  • Added new tests to cover the fix / functionality

Copy link

changeset-bot bot commented May 24, 2024

⚠️ No Changeset found

Latest commit: 0ad902d

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link

pkg-pr-new bot commented May 24, 2024

Last Commit Build: 0ad902d

@qwik-ui/headless(0ad902d):

npm i https://pkg.pr.new/qwikifiers/qwik-ui/@qwik-ui/headless@0ad902d    

Pull Request Build: #763

@qwik-ui/headless(#763):

npm i https://pkg.pr.new/qwikifiers/qwik-ui/@qwik-ui/headless@763    

@TheMcnafaha
Copy link
Member

It's unix tradition that cli programs that error out send a positive integer value to stdout or stderr. If this script is very close to the user, it probably makes sense to send the error message to stdout. If the script is further away, or it runs in the background, stderr is usually the go to.

It appears that this is convention is already being used through this function:

function exitWithError(message: string) {
  log.error(message);
  cancel();
  process.exit(1);
}

Do you think it would make sense to throw an error that writes to stdout if the config file is not written? And if not, what exactly is the point of a try catch that only sends a console log? If the error is worth catching I would think it's worth throwing too.

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