Skip to content

Commit

Permalink
don't use errors.Wrap in new code
Browse files Browse the repository at this point in the history
  • Loading branch information
DoctorVin committed Sep 20, 2024
1 parent 8299d61 commit 7efea57
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions providers/asrockrack/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import (
"github.com/bmc-toolbox/bmclib/v2/constants"
brrs "github.com/bmc-toolbox/bmclib/v2/errors"
"github.com/bmc-toolbox/common"
"github.com/pkg/errors"
)

// API session setup response payload
Expand Down Expand Up @@ -229,7 +228,7 @@ func (a *ASRockRack) uploadFirmware(ctx context.Context, endpoint string, file *
var size int64
finfo, err := file.Stat()
if err != nil {
return errors.Wrap(err, "unable to determine file size")
return fmt.Errorf("unable to determine file size: %w", err)
}

size = finfo.Size()
Expand Down Expand Up @@ -558,7 +557,7 @@ func (a *ASRockRack) httpsLogin(ctx context.Context) error {

resp, statusCode, err := a.queryHTTPS(ctx, urlEndpoint, "POST", bytes.NewReader(payload), headers, 0)
if err != nil {
return errors.Wrap(err, "logging in")
return fmt.Errorf("logging in: %w", err)
}

if statusCode == 401 {
Expand All @@ -568,7 +567,7 @@ func (a *ASRockRack) httpsLogin(ctx context.Context) error {
// Unmarshal login session
err = json.Unmarshal(resp, a.loginSession)
if err != nil {
return errors.Wrap(err, "unmarshalling response payload")
return fmt.Errorf("unmarshalling response payload: %w", err)
}

return nil
Expand All @@ -578,7 +577,7 @@ func (a *ASRockRack) httpsLogin(ctx context.Context) error {
func (a *ASRockRack) httpsLogout(ctx context.Context) error {
_, statusCode, err := a.queryHTTPS(ctx, "api/session", "DELETE", nil, nil, 0)
if err != nil {
return errors.Wrap(err, "logging out")
return fmt.Errorf("logging out: %w", err)
}

if statusCode != http.StatusOK {
Expand Down

0 comments on commit 7efea57

Please sign in to comment.