From aebf3b829e7e99efa6924eac9b2626ee3f3650b2 Mon Sep 17 00:00:00 2001 From: Steve Gardner Date: Wed, 13 Mar 2019 16:20:11 -0400 Subject: [PATCH] Add a better error message when uploading with a zip --- src/commands/upload.js | 17 ++++++++++------- src/utils/api.js | 7 +++++++ 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/src/commands/upload.js b/src/commands/upload.js index 3487b1a..e549db2 100644 --- a/src/commands/upload.js +++ b/src/commands/upload.js @@ -3,13 +3,16 @@ const utils = require('../utils'); const upload = context => { context.line('Preparing to upload a new version.\n'); - return utils.upload().then(() => { - context.line( - `\nUpload of ${constants.BUILD_PATH} and ${ - constants.SOURCE_PATH - } complete! Try \`zapier versions\` now!` - ); - }); + return utils + .upload() + .then(() => { + context.line( + `\nUpload of ${constants.BUILD_PATH} and ${ + constants.SOURCE_PATH + } complete! Try \`zapier versions\` now!` + ); + }) + .catch(error => Promise.reject(error)); }; upload.argsSpec = []; upload.argOptsSpec = {}; diff --git a/src/utils/api.js b/src/utils/api.js index b2edf97..b8c9ba5 100644 --- a/src/utils/api.js +++ b/src/utils/api.js @@ -270,6 +270,13 @@ const upload = (zipPath, sourceZipPath, appDir) => { const fullZipPath = path.resolve(appDir, zipPath); const fullSourceZipPath = path.resolve(appDir, sourceZipPath); + const isMissingZip = !fs.existsSync(fullZipPath); + + if (isMissingZip) { + return Promise.reject( + new Error('Missing a built app. Trying running `zapier push`.') + ); + } return getLinkedApp(appDir) .then(app => {