Skip to content

Commit

Permalink
use fmt.errorf
Browse files Browse the repository at this point in the history
  • Loading branch information
EronWright committed May 10, 2024
1 parent ff22a11 commit 5342b6b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
5 changes: 3 additions & 2 deletions provider/pkg/helm/keyring.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
package helm

import (
"fmt"
"net/url"
"os"

Expand Down Expand Up @@ -50,11 +51,11 @@ func LocateKeyring(p getter.Providers, asset pulumi.Asset) (string, error) {
}
g, err := p.ByScheme(u.Scheme)
if err != nil {
return "", errors.Wrapf(err, "no protocol handler for uri %q", asset.URI())
return "", fmt.Errorf("no protocol handler for uri %q", asset.URI())
}
data, err := g.Get(asset.URI(), getter.WithURL(asset.URI()))
if err != nil {
return "", errors.Wrapf(err, "failed to read uri %q", asset.URI())
return "", fmt.Errorf("failed to read uri %q: %w", asset.URI(), err)
}
return makeTemp(data.Bytes())
default:
Expand Down
7 changes: 4 additions & 3 deletions provider/pkg/helm/values.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
package helm

import (
"fmt"
"net/url"
"os"

Expand Down Expand Up @@ -70,7 +71,7 @@ func readAsset(p getter.Providers, asset pulumi.Asset) ([]byte, error) {
case asset.Path() != "":
bytes, err := os.ReadFile(asset.Path())
if err != nil {
return nil, errors.Wrapf(err, "failed to read file %q", asset.Path())
return nil, fmt.Errorf("failed to read file %q: %w", asset.Path(), err)
}
return bytes, nil
case asset.URI() != "":
Expand All @@ -80,11 +81,11 @@ func readAsset(p getter.Providers, asset pulumi.Asset) ([]byte, error) {
}
g, err := p.ByScheme(u.Scheme)
if err != nil {
return nil, errors.Wrapf(err, "no protocol handler for uri %q", asset.URI())
return nil, fmt.Errorf("no protocol handler for uri %q", asset.URI())
}
data, err := g.Get(asset.URI(), getter.WithURL(asset.URI()))
if err != nil {
return nil, errors.Wrapf(err, "failed to read uri %q", asset.URI())
return nil, fmt.Errorf("failed to read uri %q: %w", asset.URI(), err)
}
return data.Bytes(), nil
default:
Expand Down

0 comments on commit 5342b6b

Please sign in to comment.