From e64ac06af88ac205fd4b663306ee32f5c79a94e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20de=20Juvigny?= Date: Fri, 2 Oct 2020 12:36:50 +0200 Subject: [PATCH] Better error handling MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Rémi de Juvigny --- packages/strapi-generate-new/lib/merge-template.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/strapi-generate-new/lib/merge-template.js b/packages/strapi-generate-new/lib/merge-template.js index 2428bbb789..5726b7bdcd 100644 --- a/packages/strapi-generate-new/lib/merge-template.js +++ b/packages/strapi-generate-new/lib/merge-template.js @@ -100,13 +100,13 @@ async function checkTemplateContentsStructure(templateContentsPath) { } function getRepoInfo(githubURL) { - const { type, user, project } = gitInfo.fromUrl(githubURL); + const info = gitInfo.fromUrl(githubURL); // 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'); } - return { user, project }; + return { user: info.user, project: info.project }; } async function downloadGithubRepo(repoInfo, templatePath) {