Skip to content

Commit 5964c54

Browse files
authored
Merge pull request #469 from nobkd/fix/create
catch error downloading template
2 parents 81e5ed7 + 32db763 commit 5964c54

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

packages/nuekit/src/create.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,11 @@ export async function create({ root, name = 'simple-blog', port }) {
4040
// download archive
4141
console.info('Loading template...')
4242
const archive_name = join(root, `${name}-source.tar.gz`)
43-
const archive = await fetch(`https://${name}.nuejs.org/${debug ? 'test' : 'source'}.tar.gz`)
43+
const archive_web = `https://${name}.nuejs.org/${debug ? 'test' : 'source'}.tar.gz`
44+
const archive = await fetch(archive_web)
45+
46+
// catch download issues
47+
if (archive.status != 200) return console.error(`Downloading template "${archive_web}" failed with "${archive.statusText}".`)
4448
await fs.writeFile(archive_name, Buffer.from(await archive.arrayBuffer()))
4549

4650
// uncompress

0 commit comments

Comments
 (0)