-
Notifications
You must be signed in to change notification settings - Fork 48
Conversation
b824ee5
to
059071f
Compare
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.
+1. Thanks @dev-gaur for your contribution
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.
Thanks for your contribution @dev-gaur. Before we can merge, please fix new sentences in the error messages, they should start with capital letter.
While we touch error messages, it would also be nice to re-phrase them properly, as we discuss, even though the decision is not finalized yet. See #953 and #883 for more details. TL;DR we would also remove failed
, error
etc keywords from error messages, leaving only for example checking Terraform version
, as the fact that this is the error is implied. I posted 2 suggestions how it should look like.
However, this is of course optional for your work, as the changes presented in the PR are already a nice improvement :)
pkg/terraform/executor.go
Outdated
} | ||
|
||
if n != 1 { | ||
return fmt.Errorf("Parsing Terraform version failed") | ||
return fmt.Errorf("parsing Terraform version failed") |
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.
return fmt.Errorf("parsing Terraform version failed") | |
return fmt.Errorf("parsing Terraform version") |
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.
@invidian now the string parsing Terraform version
will look like a log message instead of an error message.
how about error occured while parsing Terraform version
or unable to parse Terraform version
?
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.
this might help. Please check https://github.com/kinvolk/lokomotive/pull/953/files#diff-a4a1697930a32405cd5efdc7aa09b71fR38
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.
Hmm, now that I think about it, this error message doesn't seem helpful at all. We could include expected format and parsed value in it.
Also, I look at the documentation of fmt.Sscanf
right now and try to figure out in which case it returns error here.
Looking at https://golang.org/src/fmt/scan.go?s=4522:4597#L1181, I think it will always return err if n
is different than number of operands passed. Would be good to have some unit tests for it :/
059071f
to
01ebbff
Compare
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.
LGTM
Actually, before we close #637, we should also fix |
@invidian do you mean |
@dev-gaur it seems all
|
Aah I see. I thought you wanted to remove capitalization.. I have a confusion: |
Because those are the messages, which gets printed to the user, so they should be capitalized. |
01ebbff
to
9526a88
Compare
Thanks for clarifying. Changes made. |
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.
Looks awesome now @dev-gaur. Thanks a lot for your effort!
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.
+1. Thanks again for the effort.
even I learnt a bit about error formatting :) |
fixes #637