Better error handling

Signed-off-by: Rémi de Juvigny <remi@hey.com>
This commit is contained in:
Rémi de Juvigny 2020-10-02 12:36:50 +02:00
parent 0e064d10e8
commit e64ac06af8

View File

@ -100,13 +100,13 @@ async function checkTemplateContentsStructure(templateContentsPath) {
} }
function getRepoInfo(githubURL) { function getRepoInfo(githubURL) {
const { type, user, project } = gitInfo.fromUrl(githubURL); const info = gitInfo.fromUrl(githubURL);
// Make sure it's a github url // Make sure it's a github url
if (type !== 'github') { if (info == null || info.type !== 'github') {
throw Error('A Strapi template can only be a GitHub URL'); throw Error('A Strapi template can only be a GitHub URL');
} }
return { user, project }; return { user: info.user, project: info.project };
} }
async function downloadGithubRepo(repoInfo, templatePath) { async function downloadGithubRepo(repoInfo, templatePath) {