[#1535] morph: Unify test invoke error messages
All checks were successful
Tests and linters / Run gofumpt (push) Successful in 2m10s
Tests and linters / Staticcheck (push) Successful in 2m52s
Vulncheck / Vulncheck (push) Successful in 2m50s
Build / Build Components (push) Successful in 3m23s
Pre-commit hooks / Pre-commit (push) Successful in 3m33s
Tests and linters / gopls check (push) Successful in 4m8s
Tests and linters / Lint (push) Successful in 4m16s
Tests and linters / Tests (push) Successful in 4m19s
Tests and linters / Tests with -race (push) Successful in 5m1s
All checks were successful
Tests and linters / Run gofumpt (push) Successful in 2m10s
Tests and linters / Staticcheck (push) Successful in 2m52s
Vulncheck / Vulncheck (push) Successful in 2m50s
Build / Build Components (push) Successful in 3m23s
Pre-commit hooks / Pre-commit (push) Successful in 3m33s
Tests and linters / gopls check (push) Successful in 4m8s
Tests and linters / Lint (push) Successful in 4m16s
Tests and linters / Tests (push) Successful in 4m19s
Tests and linters / Tests with -race (push) Successful in 5m1s
Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
This commit is contained in:
parent
e37dcdf88b
commit
e3487d5af5
12 changed files with 20 additions and 18 deletions
|
@ -23,7 +23,7 @@ func (c *Client) BalanceOf(id user.ID) (*big.Int, error) {
|
|||
|
||||
prms, err := c.client.TestInvoke(invokePrm)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("could not perform test invocation (%s): %w", balanceOfMethod, err)
|
||||
return nil, fmt.Errorf("test invoke (%s): %w", balanceOfMethod, err)
|
||||
} else if ln := len(prms); ln != 1 {
|
||||
return nil, fmt.Errorf("unexpected stack item count (%s): %d", balanceOfMethod, ln)
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ func (c *Client) Decimals() (uint32, error) {
|
|||
|
||||
prms, err := c.client.TestInvoke(invokePrm)
|
||||
if err != nil {
|
||||
return 0, fmt.Errorf("could not perform test invocation (%s): %w", decimalsMethod, err)
|
||||
return 0, fmt.Errorf("test invoke (%s): %w", decimalsMethod, err)
|
||||
} else if ln := len(prms); ln != 1 {
|
||||
return 0, fmt.Errorf("unexpected stack item count (%s): %d", decimalsMethod, ln)
|
||||
}
|
||||
|
|
|
@ -39,7 +39,7 @@ func (c *Client) DeletionInfo(cid []byte) (*containercore.DelInfo, error) {
|
|||
if strings.Contains(err.Error(), containerContract.NotFoundError) {
|
||||
return nil, new(apistatus.ContainerNotFound)
|
||||
}
|
||||
return nil, fmt.Errorf("could not perform test invocation (%s): %w", deletionInfoMethod, err)
|
||||
return nil, fmt.Errorf("test invoke (%s): %w", deletionInfoMethod, err)
|
||||
} else if ln := len(res); ln != 1 {
|
||||
return nil, fmt.Errorf("unexpected stack item count (%s): %d", deletionInfoMethod, ln)
|
||||
}
|
||||
|
|
|
@ -53,7 +53,7 @@ func (c *Client) Get(cid []byte) (*containercore.Container, error) {
|
|||
if strings.Contains(err.Error(), containerContract.NotFoundError) {
|
||||
return nil, new(apistatus.ContainerNotFound)
|
||||
}
|
||||
return nil, fmt.Errorf("could not perform test invocation (%s): %w", getMethod, err)
|
||||
return nil, fmt.Errorf("test invoke (%s): %w", getMethod, err)
|
||||
} else if ln := len(res); ln != 1 {
|
||||
return nil, fmt.Errorf("unexpected stack item count (%s): %d", getMethod, ln)
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ func (c *Client) list(idUser *user.ID) ([]cid.ID, error) {
|
|||
|
||||
res, err := c.client.TestInvoke(prm)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("could not perform test invocation (%s): %w", listMethod, err)
|
||||
return nil, fmt.Errorf("test invoke (%s): %w", listMethod, err)
|
||||
} else if ln := len(res); ln != 1 {
|
||||
return nil, fmt.Errorf("unexpected stack item count (%s): %d", listMethod, ln)
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ func (c *Client) GetSubject(addr util.Uint160) (*frostfsidclient.Subject, error)
|
|||
|
||||
res, err := c.client.TestInvoke(prm)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("could not perform test invocation (%s): %w", methodGetSubject, err)
|
||||
return nil, fmt.Errorf("test invoke (%s): %w", methodGetSubject, err)
|
||||
}
|
||||
|
||||
structArr, err := checkStackItem(res)
|
||||
|
@ -44,7 +44,7 @@ func (c *Client) GetSubjectExtended(addr util.Uint160) (*frostfsidclient.Subject
|
|||
|
||||
res, err := c.client.TestInvoke(prm)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("could not perform test invocation (%s): %w", methodGetSubjectExtended, err)
|
||||
return nil, fmt.Errorf("test invoke (%s): %w", methodGetSubjectExtended, err)
|
||||
}
|
||||
|
||||
structArr, err := checkStackItem(res)
|
||||
|
|
|
@ -206,7 +206,7 @@ func (c *Client) ReadNetworkConfiguration() (NetworkConfiguration, error) {
|
|||
|
||||
items, err := c.client.TestInvoke(prm)
|
||||
if err != nil {
|
||||
return res, fmt.Errorf("could not perform test invocation (%s): %w",
|
||||
return res, fmt.Errorf("test invoke (%s): %w",
|
||||
configListMethod, err)
|
||||
}
|
||||
|
||||
|
@ -292,7 +292,7 @@ func (c *Client) config(key []byte, assert func(stackitem.Item) (any, error)) (a
|
|||
|
||||
items, err := c.client.TestInvoke(prm)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("could not perform test invocation (%s): %w",
|
||||
return nil, fmt.Errorf("test invoke (%s): %w",
|
||||
configMethod, err)
|
||||
}
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ func (c *Client) Epoch() (uint64, error) {
|
|||
|
||||
items, err := c.client.TestInvoke(prm)
|
||||
if err != nil {
|
||||
return 0, fmt.Errorf("could not perform test invocation (%s): %w",
|
||||
return 0, fmt.Errorf("test invoke (%s): %w",
|
||||
epochMethod, err)
|
||||
}
|
||||
|
||||
|
@ -38,7 +38,7 @@ func (c *Client) LastEpochBlock() (uint32, error) {
|
|||
|
||||
items, err := c.client.TestInvoke(prm)
|
||||
if err != nil {
|
||||
return 0, fmt.Errorf("could not perform test invocation (%s): %w",
|
||||
return 0, fmt.Errorf("test invoke (%s): %w",
|
||||
lastEpochBlockMethod, err)
|
||||
}
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ func (c *Client) GetInnerRingList() (keys.PublicKeys, error) {
|
|||
|
||||
prms, err := c.client.TestInvoke(invokePrm)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("could not perform test invocation (%s): %w", innerRingListMethod, err)
|
||||
return nil, fmt.Errorf("test invoke (%s): %w", innerRingListMethod, err)
|
||||
}
|
||||
|
||||
return irKeysFromStackItem(prms, innerRingListMethod)
|
||||
|
|
|
@ -18,7 +18,7 @@ func (c *Client) GetNetMapByEpoch(epoch uint64) (*netmap.NetMap, error) {
|
|||
|
||||
res, err := c.client.TestInvoke(invokePrm)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("could not perform test invocation (%s): %w",
|
||||
return nil, fmt.Errorf("test invoke (%s): %w",
|
||||
epochSnapshotMethod, err)
|
||||
}
|
||||
|
||||
|
@ -40,7 +40,7 @@ func (c *Client) GetCandidates() ([]netmap.NodeInfo, error) {
|
|||
|
||||
res, err := c.client.TestInvoke(invokePrm)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("could not perform test invocation (%s): %w", netMapCandidatesMethod, err)
|
||||
return nil, fmt.Errorf("test invoke (%s): %w", netMapCandidatesMethod, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
|
@ -57,7 +57,7 @@ func (c *Client) NetMap() (*netmap.NetMap, error) {
|
|||
|
||||
res, err := c.client.TestInvoke(invokePrm)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("could not perform test invocation (%s): %w",
|
||||
return nil, fmt.Errorf("test invoke (%s): %w",
|
||||
netMapMethod, err)
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
package netmap
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/morph/client"
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/netmap"
|
||||
)
|
||||
|
@ -13,7 +15,7 @@ func (c *Client) GetNetMap(diff uint64) (*netmap.NetMap, error) {
|
|||
|
||||
res, err := c.client.TestInvoke(prm)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return nil, fmt.Errorf("test invoke (%s): %w", snapshotMethod, err)
|
||||
}
|
||||
|
||||
return DecodeNetMap(res)
|
||||
|
|
|
@ -239,7 +239,7 @@ func (c *Client) GetNotaryDeposit() (res int64, err error) {
|
|||
|
||||
items, err := c.TestInvoke(c.notary.notary, notaryBalanceOfMethod, sh)
|
||||
if err != nil {
|
||||
return 0, fmt.Errorf("%v: %w", notaryBalanceErrMsg, err)
|
||||
return 0, fmt.Errorf("test invoke (%s): %w", notaryBalanceOfMethod, err)
|
||||
}
|
||||
|
||||
if len(items) != 1 {
|
||||
|
@ -654,7 +654,7 @@ func (c *Client) notaryTxValidationLimit() (uint32, error) {
|
|||
func (c *Client) depositExpirationOf() (int64, error) {
|
||||
expirationRes, err := c.TestInvoke(c.notary.notary, notaryExpirationOfMethod, c.acc.PrivateKey().GetScriptHash())
|
||||
if err != nil {
|
||||
return 0, fmt.Errorf("can't invoke method: %w", err)
|
||||
return 0, fmt.Errorf("test invoke (%s): %w", notaryExpirationOfMethod, err)
|
||||
}
|
||||
|
||||
if len(expirationRes) != 1 {
|
||||
|
|
Loading…
Reference in a new issue