Skip to content
This repository has been archived by the owner on Jun 27, 2019. It is now read-only.

Add a better error message when uploading with a zip #408

Merged
merged 1 commit into from
Mar 15, 2019

Conversation

stevelikesmusic
Copy link
Contributor

Description

When a dev attempts to zapier upload without having built the integration, we silently fail when trying to read the zip.

Instead, we'll check to see if the zip exists, and then suggest running zapier push if we still need to build.

Issue

#351

@stevelikesmusic stevelikesmusic requested a review from xavdid March 13, 2019 20:22
src/utils/api.js Outdated

if (isMissingZip) {
return Promise.reject(
new Error('Missing a built app. Trying running `zapier push`.')
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alternatively, we could just console.error or catch this one level up and context.line. I'm in favor of more general error handling in entry where this ends up.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I like that a little more, but it's not a blocker for me

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're more in favor of console.error right here?

@stevelikesmusic stevelikesmusic force-pushed the fix/better-upload-messaging branch from aebf3b8 to d68f3bd Compare March 13, 2019 20:24
Copy link
Contributor

@xavdid xavdid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good! If you're cool converting it to async then i'll take another look when that's done. otherwise, it looks 👍

src/utils/api.js Outdated

if (isMissingZip) {
return Promise.reject(
new Error('Missing a built app. Trying running `zapier push`.')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I like that a little more, but it's not a blocker for me

} complete! Try \`zapier versions\` now!`
);
});
return utils
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

while you're in here, do you mind converting this to async? we've been doing that with other commands as we go, which will eventually remove our dependence on babel.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can definitely do that! Curious though—what's preventing us from dropping babel now? If it's just waiting to convert to async/await, I would think we could run the CLI in node natively.

@stevelikesmusic stevelikesmusic force-pushed the fix/better-upload-messaging branch from 4561d22 to 15b9a1a Compare March 14, 2019 15:34
@@ -123,7 +123,7 @@ module.exports = argv => {
process.exit(1);
}

commandFunc.apply(commands, [context].concat(args)).catch(err => {
commandFunc(context, ...args).catch(err => {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left this .catch so we didn't grab any unintended Errors here.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i was worried about this change but it looks like it didn't need to be passing the command object before, so we're good!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exactly, I checked and we're not even referencing this anywhere.

src/utils/api.js Outdated
const isMissingZip = !fs.existsSync(fullZipPath);

if (isMissingZip) {
throw new Error('Missing a built app. Trying running `zapier push`.');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thinking about it, this is a little bit of an odd error message. I'd probably change it to "Try running zapier build", since push will have automatically run build and if they're seeing this message, it's because they're manually calling upload before build.

Also there's a typo: Trying running

Copy link
Contributor Author

@stevelikesmusic stevelikesmusic Mar 14, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typos...

My thought is if they're running upload without build, there's a gap with their CLI knowledge. What if we at least say something like You need to run zapier build first. Or you could run zapier push, which will build and upload in one command.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Love it!

@@ -123,7 +123,7 @@ module.exports = argv => {
process.exit(1);
}

commandFunc.apply(commands, [context].concat(args)).catch(err => {
commandFunc(context, ...args).catch(err => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i was worried about this change but it looks like it didn't need to be passing the command object before, so we're good!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants