summaryrefslogtreecommitdiff
path: root/packages/create-astro
diff options
context:
space:
mode:
authorGravatar Chris Swithinbank <swithinbank@gmail.com> 2023-01-21 00:04:39 +0100
committerGravatar GitHub <noreply@github.com> 2023-01-21 00:04:39 +0100
commitf27bb3d79f9774f01037e60e656b1f9d8e03367d (patch)
tree0f3e547ea6385a0887c0a6437b538fa00d893584 /packages/create-astro
parentad13467a8481b3a25754ba368e05e243b04506f5 (diff)
downloadastro-f27bb3d79f9774f01037e60e656b1f9d8e03367d.tar.gz
astro-f27bb3d79f9774f01037e60e656b1f9d8e03367d.tar.zst
astro-f27bb3d79f9774f01037e60e656b1f9d8e03367d.zip
Improve error message for third-party template 404s (#5920)
Diffstat (limited to '')
-rw-r--r--packages/create-astro/src/index.ts15
1 files changed, 14 insertions, 1 deletions
diff --git a/packages/create-astro/src/index.ts b/packages/create-astro/src/index.ts
index 4a4008438..5b4973a12 100644
--- a/packages/create-astro/src/index.ts
+++ b/packages/create-astro/src/index.ts
@@ -192,7 +192,20 @@ export async function main() {
} catch (err: any) {
fs.rmdirSync(cwd);
if (err.message.includes('404')) {
- console.error(`Template ${color.underline(options.template)} does not exist!`);
+ console.error(`Could not find template ${color.underline(options.template)}!`);
+ if (isThirdParty) {
+ const hasBranch = options.template.includes('#');
+ if (hasBranch) {
+ console.error('Are you sure this GitHub repo and branch exist?');
+ } else {
+ console.error(
+ `Are you sure this GitHub repo exists?` +
+ `This command uses the ${color.bold('main')} branch by default.\n` +
+ `If the repo doesn't have a main branch, specify a custom branch name:\n` +
+ color.underline(options.template + color.bold('#branch-name'))
+ );
+ }
+ }
} else {
console.error(err.message);
}