[#1558] morph/client: Remove "could not"/"can't"/"failed to" from error messages

Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
This commit is contained in:
Evgenii Stratonikov 2024-12-12 15:06:20 +03:00
parent 91d9dc2676
commit 7151c71d51
Signed by: fyrchik
SSH key fingerprint: SHA256:m/TTwCzjnRkXgnzEx9X92ccxy1CcVeinOgDb3NPWWmg
19 changed files with 55 additions and 55 deletions

View file

@ -25,7 +25,7 @@ func (c *Client) Epoch() (uint64, error) {
num, err := client.IntFromStackItem(items[0])
if err != nil {
return 0, fmt.Errorf("could not get number from stack item (%s): %w", epochMethod, err)
return 0, fmt.Errorf("get number from stack item (%s): %w", epochMethod, err)
}
return uint64(num), nil
}
@ -49,7 +49,7 @@ func (c *Client) LastEpochBlock() (uint32, error) {
block, err := client.IntFromStackItem(items[0])
if err != nil {
return 0, fmt.Errorf("could not get number from stack item (%s): %w",
return 0, fmt.Errorf("get number from stack item (%s): %w",
lastEpochBlockMethod, err)
}
return uint32(block), nil

View file

@ -59,7 +59,7 @@ func irKeysFromStackItem(stack []stackitem.Item, method string) (keys.PublicKeys
irs, err := client.ArrayFromStackItem(stack[0])
if err != nil {
return nil, fmt.Errorf("could not get stack item array from stack item (%s): %w", method, err)
return nil, fmt.Errorf("get stack item array from stack item (%s): %w", method, err)
}
irKeys := make(keys.PublicKeys, len(irs))
@ -79,7 +79,7 @@ const irNodeFixedPrmNumber = 1
func irKeyFromStackItem(prm stackitem.Item) (*keys.PublicKey, error) {
prms, err := client.ArrayFromStackItem(prm)
if err != nil {
return nil, fmt.Errorf("could not get stack item array (IRNode): %w", err)
return nil, fmt.Errorf("get stack item array (IRNode): %w", err)
} else if ln := len(prms); ln != irNodeFixedPrmNumber {
return nil, fmt.Errorf(
"unexpected stack item count (IRNode): expected %d, has %d",
@ -90,7 +90,7 @@ func irKeyFromStackItem(prm stackitem.Item) (*keys.PublicKey, error) {
byteKey, err := client.BytesFromStackItem(prms[0])
if err != nil {
return nil, fmt.Errorf("could not parse bytes from stack item (IRNode): %w", err)
return nil, fmt.Errorf("parse bytes from stack item (IRNode): %w", err)
}
return keys.NewPublicKeyFromBytes(byteKey, elliptic.P256())

View file

@ -16,7 +16,7 @@ func (c *Client) NewEpoch(ctx context.Context, epoch uint64) error {
_, err := c.client.Invoke(ctx, prm)
if err != nil {
return fmt.Errorf("could not invoke method (%s): %w", newEpochMethod, err)
return fmt.Errorf("invoke method (%s): %w", newEpochMethod, err)
}
return nil
}
@ -34,7 +34,7 @@ func (c *Client) NewEpochControl(ctx context.Context, epoch uint64, vub uint32)
res, err := c.client.Invoke(ctx, prm)
if err != nil {
return 0, fmt.Errorf("could not invoke method (%s): %w", newEpochMethod, err)
return 0, fmt.Errorf("invoke method (%s): %w", newEpochMethod, err)
}
return res.VUB, nil
}

View file

@ -41,7 +41,7 @@ func (c *Client) AddPeer(ctx context.Context, p AddPeerPrm) error {
prm.InvokePrmOptional = p.InvokePrmOptional
if _, err := c.client.Invoke(ctx, prm); err != nil {
return fmt.Errorf("could not invoke method (%s): %w", method, err)
return fmt.Errorf("invoke method (%s): %w", method, err)
}
return nil
}