Skip to content
This repository has been archived by the owner on Apr 30, 2024. It is now read-only.

Commit

Permalink
Update error packages used
Browse files Browse the repository at this point in the history
  • Loading branch information
Manav-Aggarwal committed Oct 20, 2022
1 parent d0136bc commit c00bec5
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions store/tracekv/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"errors"
"io"

sdkerrors "cosmossdk.io/errors"
"github.com/chrispappas/golang-generics-set/set"
"github.com/cosmos/cosmos-sdk/store/types"
)
Expand Down Expand Up @@ -112,7 +113,7 @@ func (tkv *Store) GetAllKeysUsedInTrace(buf bytes.Buffer) set.Set[string] {
}
key, err := base64.StdEncoding.DecodeString(traceOp.Key)
if err != nil {
panic(errors.Wrap(err, "failed to decode key read from buf"))
panic(sdkerrors.Wrap(err, "failed to decode key read from buf"))
}
keys.Add(string(key))
}
Expand Down Expand Up @@ -221,11 +222,11 @@ func writeOperation(w io.Writer, op operation, tc types.TraceContext, key, value

raw, err := json.Marshal(traceOp)
if err != nil {
panic(errors.Wrap(err, "failed to serialize trace operation"))
panic(sdkerrors.Wrap(err, "failed to serialize trace operation"))
}

if _, err := w.Write(raw); err != nil {
panic(errors.Wrap(err, "failed to write trace operation"))
panic(sdkerrors.Wrap(err, "failed to write trace operation"))
}

io.WriteString(w, "\n")
Expand All @@ -239,12 +240,12 @@ func readOperation(r *bytes.Buffer) (*traceOperation, error) {
return nil, ErrBufferEmpty
}
if err != nil {
return nil, errors.Wrap(err, "failed to read trace operation")
return nil, sdkerrors.Wrap(err, "failed to read trace operation")
}
traceOp := traceOperation{}
err = json.Unmarshal([]byte(raw), &traceOp)
if err != nil {
return nil, errors.Wrap(err, "failed to deserialize trace operation")
return nil, sdkerrors.Wrap(err, "failed to deserialize trace operation")
}

return &traceOp, nil
Expand Down

0 comments on commit c00bec5

Please sign in to comment.