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

Print a warning if the function project root can't be found on deploy #3764

Merged
merged 1 commit into from
Jul 19, 2023

Conversation

mkfrey
Copy link
Contributor

@mkfrey mkfrey commented Jul 19, 2023

Inform the user that the project root could not be found instead of throwing a generic null value error and suggest a possible cause.

Currently, if no hosts.json exists in the project directory (e.g. because it was accidentally deleted or not commited), the right click -> "Deploy to ..." functionality will just return the cryptic message Internal error: Expected value to be neither null nor undefined on the error console.

This commit will let the extension show a warning message instead indicating that no project root could be found.

@mkfrey mkfrey requested a review from a team as a code owner July 19, 2023 12:11
@mkfrey mkfrey force-pushed the main branch 2 times, most recently from 0c6e716 to 6bc2664 Compare July 19, 2023 12:47
Comment on lines 51 to 52
await actionContext.ui.showWarningMessage(message, { stepName: "functionProjectRootNotFound" })
return
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
await actionContext.ui.showWarningMessage(message, { stepName: "functionProjectRootNotFound" })
return
throw new Error(message);

Throwing an exception here would be best as it stops execution, and will automatically show an error notification.

…deploy

Inform the user that the project root could not be found instead of
throwing a generic null value error and suggest a possible cause.
Copy link
Member

@alexweininger alexweininger left a comment

Choose a reason for hiding this comment

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

Thank you for your contribution!

@alexweininger alexweininger merged commit 2eb49f5 into microsoft:main Jul 19, 2023
@alexweininger
Copy link
Member

alexweininger commented Jul 20, 2023

@mkfrey, these changes have been released in version 1.12.1 of the extension.

@microsoft microsoft locked and limited conversation to collaborators Sep 3, 2023
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