[#521] *: use stdlib errors package

Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
This commit is contained in:
Evgenii Stratonikov 2021-05-18 11:12:51 +03:00 committed by Alex Vanin
parent 43e575cec2
commit 71b87155ef
171 changed files with 825 additions and 674 deletions

View file

@ -1,8 +1,9 @@
package reputation
import (
"fmt"
"github.com/nspcc-dev/neofs-node/pkg/morph/client"
"github.com/pkg/errors"
)
// ListByEpochArgs groups the arguments of
@ -35,14 +36,14 @@ func (c *Client) ListByEpoch(args ListByEpochArgs) (*ListByEpochResult, error) {
int64(args.epoch),
)
if err != nil {
return nil, errors.Wrapf(err, "could not perform test invocation (%s)", c.listByEpochMethod)
return nil, fmt.Errorf("could not perform test invocation (%s): %w", c.listByEpochMethod, err)
} else if ln := len(prms); ln != 1 {
return nil, errors.Errorf("unexpected stack item count (%s): %d", c.listByEpochMethod, ln)
return nil, fmt.Errorf("unexpected stack item count (%s): %d", c.listByEpochMethod, ln)
}
items, err := client.ArrayFromStackItem(prms[0])
if err != nil {
return nil, errors.Wrapf(err, "could not get stack item array from stack item (%s)", c.listByEpochMethod)
return nil, fmt.Errorf("could not get stack item array from stack item (%s): %w", c.listByEpochMethod, err)
}
res := &ListByEpochResult{
@ -52,7 +53,7 @@ func (c *Client) ListByEpoch(args ListByEpochArgs) (*ListByEpochResult, error) {
for i := range items {
rawReputation, err := client.BytesFromStackItem(items[i])
if err != nil {
return nil, errors.Wrapf(err, "could not get byte array from stack item (%s)", c.listByEpochMethod)
return nil, fmt.Errorf("could not get byte array from stack item (%s): %w", c.listByEpochMethod, err)
}
res.ids = append(res.ids, rawReputation)