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

Improve error message for third-party template 404s #5920

Merged
merged 2 commits into from
Jan 20, 2023

Conversation

delucis
Copy link
Member

@delucis delucis commented Jan 20, 2023

Changes

  • Adds a helpful error message when a third-party template passed to create astro is not found.

  • Inspired by Wrong starter template description (and typo) docs#2372

  • Currently if a user passes --template username/repo and giget fails to load that repo, the command fails and says "does not exist!":
    image

  • A common cause is that the template repo does not have a main branch (which giget assumes by default and we have no way of guessing without calling the GitHub API), so the updated error message adds some pointers

    Could not find template username/repo!
    Are you sure this GitHub repo exists? This command uses the main branch by default.
    If the repo doesn't have a main branch, specify a custom branch name:
    username/repo#branch-name

Testing

Don’t think this needs tests as it’s just a log message?

Docs

Arguably entirely docs!

@delucis delucis self-assigned this Jan 20, 2023
@changeset-bot
Copy link

changeset-bot bot commented Jan 20, 2023

🦋 Changeset detected

Latest commit: ccc12be

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

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

@github-actions github-actions bot added the pkg: create-astro Related to the `create-astro` package (scope) label Jan 20, 2023
Copy link
Member

@sarah11918 sarah11918 left a comment

Choose a reason for hiding this comment

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

Arguably, entirely approved text by Docs!

Copy link
Member

@Princesseuh Princesseuh left a comment

Choose a reason for hiding this comment

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

Looks good to me! Love good error messages 😍

@delucis delucis merged commit f27bb3d into main Jan 20, 2023
@delucis delucis deleted the chris/create-astro-better-error branch January 20, 2023 23:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pkg: create-astro Related to the `create-astro` package (scope)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants