-
Notifications
You must be signed in to change notification settings - Fork 7
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
fixed how Errors are handled #25
Conversation
pkg/vault/error.go
Outdated
MessageParts []string | ||
OriginalError error | ||
} | ||
|
||
// Error is custom error interface with one method that will block other functions | ||
// from using this Error. This is not interchangeable with the standard error. | ||
type Error interface { |
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.
Personally I would change this error name to, could possibly get away with keeping CustomVaultError
private customVaultError
and then only using the interface everywhere
pkg/vault/token.go
Outdated
@@ -11,7 +11,7 @@ func (v *Vault) GetCurrentTokenTTL() (time.Duration, error) { | |||
// Get the token info from Vault | |||
secret, err := v.client.Auth().Token().LookupSelf() | |||
if err != nil { | |||
return 0, err | |||
return 0, v.parseError(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.
This function should be returning Error not error
Errors where double printing part of the message. We found that parseError was being called two times creating this output:
2019-05-17 10:54:03.870426 [ FATAL ] Vault Error: Vault Error: Get...