Skip to content
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

Adding timeout vault option and better error handling #5

Merged
merged 3 commits into from
Mar 27, 2019

Conversation

bartlettc22
Copy link
Collaborator

  • Adding config value vault-timeout (default 15 seconds)
  • Adding better error handling for Vault operations

)

// Error is the custom error type for this package
type Error struct {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feel like this should be named something more specific, to easy to confuse error and Error and mismatch them. I would say something like StimError, or even StimVaultError

@@ -11,17 +10,17 @@ func (v *Vault) GetSecretKey(path string, key string) (string, error) {

secret, err := v.client.Logical().Read(path)
if err != nil {
return "", err
return "", v.parseError(err)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would assume you want to return Error (or whatever we might change it too) so if someone wants to handle it a different way farther down (say another stimpack calling it) they would not have to see if its castable.

MessageParts []string
OriginalError error
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might want to add a String() func to this so if someone outputs it in a log things look correct. https://tour.golang.org/methods/17

@lwahlmeier
Copy link
Member

All in all looks good, added a few comments you might want to look through.

@bartlettc22 bartlettc22 merged commit fe4dd81 into master Mar 27, 2019
@lwahlmeier lwahlmeier deleted the vault_timeout_errhandling branch February 21, 2020 17:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants