Skip to content

Commit

Permalink
Move %v->%w for errs
Browse files Browse the repository at this point in the history
Signed-off-by: Alexander Scheel <[email protected]>
  • Loading branch information
cipherboy committed Nov 16, 2022
1 parent 233bd1d commit fbfd065
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion command/healthcheck/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ func (p *PathFetch) FetchSurfaceError() error {
}

if strings.Contains(p.FetchError.Error(), "route entry not found") {
return fmt.Errorf("Error making API request: was a bad mount given?\n\nOperation: %v\nPath: %v\nOriginal Error:\n%v", p.Operation, p.Path, p.FetchError)
return fmt.Errorf("Error making API request: was a bad mount given?\n\nOperation: %v\nPath: %v\nOriginal Error:\n%w", p.Operation, p.Path, p.FetchError)
}

return p.FetchError
Expand Down
8 changes: 4 additions & 4 deletions command/healthcheck/pki.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func parsePEMCert(contents string) (*x509.Certificate, error) {

cert, err := x509.ParseCertificate(parsed)
if err != nil {
return nil, fmt.Errorf("invalid certificate: %v", err)
return nil, fmt.Errorf("invalid certificate: %w", err)
}

return cert, nil
Expand All @@ -65,7 +65,7 @@ func parsePEMCRL(contents string) (*x509.RevocationList, error) {

crl, err := x509.ParseRevocationList(parsed)
if err != nil {
return nil, fmt.Errorf("invalid CRL: %v", err)
return nil, fmt.Errorf("invalid CRL: %w", err)
}

return crl, nil
Expand All @@ -87,7 +87,7 @@ func pkiFetchIssuer(e *Executor, issuer string, versionError func()) (bool, *Pat
if len(issuerRet.ParsedCache) == 0 {
cert, err := parsePEMCert(issuerRet.Secret.Data["certificate"].(string))
if err != nil {
return true, nil, nil, fmt.Errorf("unable to parse issuer %v's certificate: %v", issuer, err)
return true, nil, nil, fmt.Errorf("unable to parse issuer %v's certificate: %w", issuer, err)
}

issuerRet.ParsedCache["certificate"] = cert
Expand Down Expand Up @@ -119,7 +119,7 @@ func pkiFetchIssuerCRL(e *Executor, issuer string, delta bool, versionError func
if len(crlRet.ParsedCache) == 0 {
crl, err := parsePEMCRL(crlRet.Secret.Data["crl"].(string))
if err != nil {
return true, nil, nil, fmt.Errorf("unable to parse issuer %v's %v: %v", issuer, name, err)
return true, nil, nil, fmt.Errorf("unable to parse issuer %v's %v: %w", issuer, name, err)
}
crlRet.ParsedCache["crl"] = crl
}
Expand Down

0 comments on commit fbfd065

Please sign in to comment.