Skip to content

Commit

Permalink
Wrap Vault API api errors for easing debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
Mahmood Ali committed Nov 2, 2018
1 parent 9ec34a2 commit 54294a4
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion nomad/vault.go
Original file line number Diff line number Diff line change
Expand Up @@ -560,7 +560,7 @@ func (v *vaultClient) renew() error {
// Attempt to renew the token
secret, err := v.auth.RenewSelf(v.tokenData.CreationTTL)
if err != nil {
return err
return fmt.Errorf("failed to renew the vault token: %v", err)
}

auth := secret.Auth
Expand Down Expand Up @@ -909,6 +909,7 @@ func (v *vaultClient) CreateToken(ctx context.Context, a *structs.Allocation, ta

// Determine whether it is unrecoverable
if err != nil {
err = fmt.Errorf("failed to create an alloc vault token: %v", err)
if structs.VaultUnrecoverableError.MatchString(err.Error()) {
return secret, err
}
Expand Down

0 comments on commit 54294a4

Please sign in to comment.