Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(command-deploy): handle deploy error when there are no files to deploy #1274

Merged
merged 3 commits into from
Sep 24, 2020

Conversation

erezrokah
Copy link
Contributor

- Summary

Fixes #1227
Dependant on netlify/js-client#161

Handles the error thrown by js-client when there are no files to deploy (cancels the created deploy).

- Test plan

Will push a test once is netlify/js-client#161 merged and published

- Description for the changelog

Handle deploy error when there are no files to deploy

- A picture of a cute animal (not mandatory but encouraged)

🐳

@github-actions github-actions bot added the type: bug code to address defects in shipped code label Sep 23, 2020
} catch (e) {
warn(`Failed canceling deploy with id ${deployId}: ${e.message}`)
}
await cancelDeploy({ api, deployId, warn })
Copy link
Contributor Author

@erezrokah erezrokah Sep 23, 2020

Choose a reason for hiding this comment

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

We can throw an error and let the calling function cancel the deploy, but we would need lift the spinner handling too.

@@ -220,6 +222,9 @@ const runDeploy = async ({
filter: getDeployFilesFilter({ site, deployFolder }),
})
} catch (e) {
if (deployId) {
Copy link
Contributor

@ehmicky ehmicky Sep 23, 2020

Choose a reason for hiding this comment

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

[sand] Should this be put inside an additional try/catch inner block around deployEdgeHandlers() + api.deploy() instead? Like this, there would be no need to check if deployId exists.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That would mean we need to re-throw the error after canceling the deploy to reach the other part of the error handling code (we could also refactor that part when we do netlify/js-client#157 to have a dedicated try/catch per operation to have better error reporting).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Going to merge and release. We can discuss this in netlify/js-client#157

Copy link
Contributor

Choose a reason for hiding this comment

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

Makes sense!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug code to address defects in shipped code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Manual deployment hangs with a deployment folder that starts with a dot
2 participants