Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion cmd/upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,14 @@ You can always delete this file.
`,
RunE: func(cmd *cobra.Command, args []string) error {
c := cli.New(Version)
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
Copy Markdown
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

Please check the FAQ for solutions to common upgrading issues.

https://exercism.io/faqs`, err)
}
return err
Copy link
Copy Markdown
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.

},
}

Expand Down