Skip to content

Commit

Permalink
refactor(dp): replace deprecated errors module (#12727)
Browse files Browse the repository at this point in the history
Replace functions `errors.Wrap` and `errors.Wrapf` from the
github.com/pgk/errors package with `fmt.Errorsf`. Created in pairing
with Moritz Huebner.

Signed-off-by: Sebastian Wolf <sebastian.wolf@tngtech.com>
  • Loading branch information
wolfseb committed May 18, 2022
1 parent 0962855 commit 222e287
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion dp/cloud/go/go.mod
Expand Up @@ -31,7 +31,6 @@ require (
github.com/golang/protobuf v1.5.2
github.com/labstack/echo v3.3.10+incompatible
github.com/olivere/elastic/v7 v7.0.6
github.com/pkg/errors v0.9.1
github.com/stretchr/testify v1.7.0
google.golang.org/grpc v1.43.0
google.golang.org/protobuf v1.28.0
Expand Down Expand Up @@ -76,6 +75,7 @@ require (
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/oklog/ulid v1.3.1 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/prometheus/client_golang v1.5.1 // indirect
github.com/prometheus/client_model v0.2.0 // indirect
Expand Down
4 changes: 2 additions & 2 deletions dp/cloud/go/services/dp/servicers/cbsd_manager.go
Expand Up @@ -16,9 +16,9 @@ package servicers
import (
"context"
"encoding/json"
"fmt"
"time"

"github.com/pkg/errors"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"

Expand Down Expand Up @@ -195,7 +195,7 @@ func cbsdFromDatabase(data *storage.DetailedCbsd, inactivityInterval time.Durati
}

func makeErr(err error, wrap string) error {
e := errors.Wrap(err, wrap)
e := fmt.Errorf(wrap+": %w", err)
code := codes.Internal
if err == merrors.ErrNotFound {
code = codes.NotFound
Expand Down

0 comments on commit 222e287

Please sign in to comment.