Errwrap everywhere (#4252)

* package api

* package builtin/credential

* package builtin/logical

* package command

* package helper

* package http and logical

* package physical

* package shamir

* package vault

* package vault

* address feedback

* more fixes
This commit is contained in:
Vishal Nayak
2018-04-05 11:49:21 -04:00
committed by GitHub
parent f13a832a9f
commit e2bb2ec3b9
159 changed files with 811 additions and 741 deletions

View File

@@ -5,6 +5,7 @@ import (
"encoding/base64"
"fmt"
"github.com/hashicorp/errwrap"
"github.com/hashicorp/vault/helper/certutil"
"github.com/hashicorp/vault/helper/errutil"
"github.com/hashicorp/vault/logical"
@@ -87,7 +88,7 @@ func (b *backend) pathGenerateIntermediate(ctx context.Context, req *logical.Req
csrb, err := parsedBundle.ToCSRBundle()
if err != nil {
return nil, fmt.Errorf("Error converting raw CSR bundle to CSR bundle: %s", err)
return nil, errwrap.Wrapf("error converting raw CSR bundle to CSR bundle: {{err}}", err)
}
resp = &logical.Response{
@@ -197,12 +198,12 @@ func (b *backend) pathSetSignedIntermediate(ctx context.Context, req *logical.Re
}
if err := inputBundle.Verify(); err != nil {
return nil, fmt.Errorf("verification of parsed bundle failed: %s", err)
return nil, errwrap.Wrapf("verification of parsed bundle failed: {{err}}", err)
}
cb, err = inputBundle.ToCertBundle()
if err != nil {
return nil, fmt.Errorf("error converting raw values into cert bundle: %s", err)
return nil, errwrap.Wrapf("error converting raw values into cert bundle: {{err}}", err)
}
entry, err = logical.StorageEntryJSON("config/ca_bundle", cb)