-
Notifications
You must be signed in to change notification settings - Fork 26
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
Standardizes errors in commands #359
Standardizes errors in commands #359
Conversation
c640a26
to
0e2d0c0
Compare
Something failed in the integration tests |
cmd/srcd/cmd/parse.go
Outdated
@@ -118,7 +118,7 @@ The remaining nodes are printed to standard output in JSON format.`, | |||
Mode: mode, | |||
}) | |||
if err != nil { | |||
return fmt.Errorf("%T %v", err, err) | |||
return fmt.Errorf("%T %v", err, humanize(err)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fatal(err, "%T", err)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
addressed here.
cmd/srcd/cmd/components.go
Outdated
@@ -43,7 +43,7 @@ var componentsListCmd = &cobra.Command{ | |||
|
|||
cmps, err := components.List(context.Background(), allVersions) | |||
if err != nil { | |||
return fatal(err, "could not list images") | |||
return wrapHumanizeErr(err, "could not list images") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit-pick: because we use this function a lot I would prefer shorter name. Options from the top of my head:
humanizef
wrapf
userErr
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know maybe whumanizef
? so that we have both humanize
and whumanizef
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
whumanizef
Please don't 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😂 I think that humanizef
is enough.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Addressed here.
0e2d0c0
to
bc9a725
Compare
Rebased and force pushed to include integration testing for OSX. Please take a look at last 3 commits, especially this. |
cmd/srcd/cmd/errors.go
Outdated
// fatal converts known errors to human friendly message and logs it with fatal level | ||
func fatal(err error, format string, args ...interface{}) { | ||
msg := fmt.Sprintf(format, args...) | ||
// wrapHumanizeErr wraps and converts known errors to human friendly message |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wrong name after the function rename.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed here.
…ands Signed-off-by: Lou Marvin Caraig <loumarvincaraig@gmail.com>
Signed-off-by: Lou Marvin Caraig <loumarvincaraig@gmail.com>
… Run Signed-off-by: Lou Marvin Caraig <loumarvincaraig@gmail.com>
9d880dd
to
92e2350
Compare
Signed-off-by: Lou Marvin Caraig <loumarvincaraig@gmail.com>
Signed-off-by: Lou Marvin Caraig <loumarvincaraig@gmail.com>
92e2350
to
365312d
Compare
Closes #291.
Closes #326.