Skip to content
This repository has been archived by the owner on Nov 1, 2022. It is now read-only.

Commit

Permalink
Merge pull request #1615 from 2opremio/fluxctl-error-context
Browse files Browse the repository at this point in the history
show more context for errors from fluxctl
  • Loading branch information
Alfonso Acosta authored Dec 27, 2018
2 parents 727fb81 + 8bcc1c5 commit f0eac80
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions cmd/fluxctl/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ func run(args []string) int {
rootCmd := newRoot().Command()
rootCmd.SetArgs(args)
if cmd, err := rootCmd.ExecuteC(); err != nil {
err = errors.Cause(err)
switch err := err.(type) {
case *fluxerr.Error:
cmd.Println("== Error ==\n\n" + err.Help)
default:
// Format flux-specific errors. They can come wrapped,
// so we use the cause instead.
if cause, ok := errors.Cause(err).(*fluxerr.Error); ok {
cmd.Println("== Error ==\n\n" + cause.Help)
} else {
cmd.Println("Error: " + err.Error())
cmd.Printf("Run '%v --help' for usage.\n", cmd.CommandPath())
}
Expand Down

0 comments on commit f0eac80

Please sign in to comment.