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

Add Descriptive Error Message to Upgrade Command #752

Merged
merged 2 commits into from
Nov 2, 2018

Conversation

farisj
Copy link
Contributor

@farisj farisj commented Oct 24, 2018

Hi there! I'm an exercism user but first time contributor. Happy Hacktoberfest! 😄 🎃

What This Does

Solves #680

This PR adds a wrapper around the exercism upgrade command which provides a more human-readable error message along with instructions to visit the FAQ page.

Currently, the FAQ page does not yet have upgrade debugging solutions, so perhaps it would be best to wait until exercism/website-copy#417 is merged as well.

Thanks for taking the time to read this PR!

cmd/upgrade.go Outdated

https://exercism.io/faqs`, err)
}
return err
Copy link
Contributor

@nywilken nywilken Oct 25, 2018

Choose a reason for hiding this comment

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

Seeing as we check for the error above lets return fmt.Errorf(...) within the condition and just return nil here.

Copy link
Contributor

@nywilken nywilken left a comment

Choose a reason for hiding this comment

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

@farisj thanks for your change! The code looks good, just a few nitpicks.

Regarding the rewording of the error message I suggest that you take a look at the error messaging for other commands (e.g download or submit) to get a sense of tone and general formatting.

Happy Hacktoberfest 🎉

cmd/upgrade.go Outdated
return updateCLI(c)
err := updateCLI(c)
if err != nil {
err = fmt.Errorf(`We were not able to upgrade the cli because we encountered an error: %s
Copy link
Contributor

@nywilken nywilken Oct 25, 2018

Choose a reason for hiding this comment

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

No need to reassign err here. Lets return the error message immediately to fail the command.

This is how the current error message will be displayed to the user.

Error: We were not able to upgrade the cli because we encountered an error: <error message>
Please check the FAQ for solutions to common upgrading issues.

Could you move the message down one line and reword the messaging a bit so that it doesn't contain error:.

Error:

We were not able to upgrade the cli....
<error message>

Please check the FAQ for solutions to common upgrading issues. 

https://exercism.io/faqs

Copy link
Contributor

@nywilken nywilken 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! Thanks for making the update. I’m going to approve since the changes to the website-copy repo were approved. I’ll merge and cut a release once the FAQs are updated.

@nywilken nywilken merged commit 97d69cc into exercism:master Nov 2, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants