forked from TrueCloudLab/frostfs-node
[#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:
parent
91d9dc2676
commit
7151c71d51
19 changed files with 55 additions and 55 deletions
|
@ -26,7 +26,7 @@ func (c *Client) ContainersOf(idUser *user.ID) ([]cid.ID, error) {
|
|||
cb := func(item stackitem.Item) error {
|
||||
rawID, err := client.BytesFromStackItem(item)
|
||||
if err != nil {
|
||||
return fmt.Errorf("could not get byte array from stack item (%s): %w", containersOfMethod, err)
|
||||
return fmt.Errorf("get byte array from stack item (%s): %w", containersOfMethod, err)
|
||||
}
|
||||
|
||||
var id cid.ID
|
||||
|
|
|
@ -78,7 +78,7 @@ func (c *Client) Delete(ctx context.Context, p DeletePrm) (uint32, error) {
|
|||
|
||||
res, err := c.client.Invoke(ctx, prm)
|
||||
if err != nil {
|
||||
return 0, fmt.Errorf("could not invoke method (%s): %w", deleteMethod, err)
|
||||
return 0, fmt.Errorf("invoke method (%s): %w", deleteMethod, err)
|
||||
}
|
||||
return res.VUB, nil
|
||||
}
|
||||
|
|
|
@ -46,7 +46,7 @@ func (c *Client) DeletionInfo(cid []byte) (*containercore.DelInfo, error) {
|
|||
|
||||
arr, err := client.ArrayFromStackItem(res[0])
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("could not get item array of container (%s): %w", deletionInfoMethod, err)
|
||||
return nil, fmt.Errorf("get item array of container (%s): %w", deletionInfoMethod, err)
|
||||
}
|
||||
|
||||
if len(arr) != 2 {
|
||||
|
@ -55,17 +55,17 @@ func (c *Client) DeletionInfo(cid []byte) (*containercore.DelInfo, error) {
|
|||
|
||||
rawOwner, err := client.BytesFromStackItem(arr[0])
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("could not get byte array of container (%s): %w", deletionInfoMethod, err)
|
||||
return nil, fmt.Errorf("get byte array of container (%s): %w", deletionInfoMethod, err)
|
||||
}
|
||||
|
||||
var owner user.ID
|
||||
if err := owner.DecodeString(base58.Encode(rawOwner)); err != nil {
|
||||
return nil, fmt.Errorf("could not decode container owner id (%s): %w", deletionInfoMethod, err)
|
||||
return nil, fmt.Errorf("decode container owner id (%s): %w", deletionInfoMethod, err)
|
||||
}
|
||||
|
||||
epoch, err := client.BigIntFromStackItem(arr[1])
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("could not get byte array of container signature (%s): %w", deletionInfoMethod, err)
|
||||
return nil, fmt.Errorf("get byte array of container signature (%s): %w", deletionInfoMethod, err)
|
||||
}
|
||||
|
||||
return &containercore.DelInfo{
|
||||
|
|
|
@ -60,7 +60,7 @@ func (c *Client) Get(cid []byte) (*containercore.Container, error) {
|
|||
|
||||
arr, err := client.ArrayFromStackItem(res[0])
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("could not get item array of container (%s): %w", getMethod, err)
|
||||
return nil, fmt.Errorf("get item array of container (%s): %w", getMethod, err)
|
||||
}
|
||||
|
||||
if len(arr) != 4 {
|
||||
|
@ -69,29 +69,29 @@ func (c *Client) Get(cid []byte) (*containercore.Container, error) {
|
|||
|
||||
cnrBytes, err := client.BytesFromStackItem(arr[0])
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("could not get byte array of container (%s): %w", getMethod, err)
|
||||
return nil, fmt.Errorf("get byte array of container (%s): %w", getMethod, err)
|
||||
}
|
||||
|
||||
sigBytes, err := client.BytesFromStackItem(arr[1])
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("could not get byte array of container signature (%s): %w", getMethod, err)
|
||||
return nil, fmt.Errorf("get byte array of container signature (%s): %w", getMethod, err)
|
||||
}
|
||||
|
||||
pub, err := client.BytesFromStackItem(arr[2])
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("could not get byte array of public key (%s): %w", getMethod, err)
|
||||
return nil, fmt.Errorf("get byte array of public key (%s): %w", getMethod, err)
|
||||
}
|
||||
|
||||
tokBytes, err := client.BytesFromStackItem(arr[3])
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("could not get byte array of session token (%s): %w", getMethod, err)
|
||||
return nil, fmt.Errorf("get byte array of session token (%s): %w", getMethod, err)
|
||||
}
|
||||
|
||||
var cnr containercore.Container
|
||||
|
||||
if err := cnr.Value.Unmarshal(cnrBytes); err != nil {
|
||||
// use other major version if there any
|
||||
return nil, fmt.Errorf("can't unmarshal container: %w", err)
|
||||
return nil, fmt.Errorf("unmarshal container: %w", err)
|
||||
}
|
||||
|
||||
if len(tokBytes) > 0 {
|
||||
|
@ -99,7 +99,7 @@ func (c *Client) Get(cid []byte) (*containercore.Container, error) {
|
|||
|
||||
err = cnr.Session.Unmarshal(tokBytes)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("could not unmarshal session token: %w", err)
|
||||
return nil, fmt.Errorf("unmarshal session token: %w", err)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -34,14 +34,14 @@ func (c *Client) list(idUser *user.ID) ([]cid.ID, error) {
|
|||
|
||||
res, err = client.ArrayFromStackItem(res[0])
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("could not get stack item array from stack item (%s): %w", listMethod, err)
|
||||
return nil, fmt.Errorf("get stack item array from stack item (%s): %w", listMethod, err)
|
||||
}
|
||||
|
||||
cidList := make([]cid.ID, 0, len(res))
|
||||
for i := range res {
|
||||
rawID, err := client.BytesFromStackItem(res[i])
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("could not get byte array from stack item (%s): %w", listMethod, err)
|
||||
return nil, fmt.Errorf("get byte array from stack item (%s): %w", listMethod, err)
|
||||
}
|
||||
|
||||
var id cid.ID
|
||||
|
|
|
@ -117,7 +117,7 @@ func (c *Client) Put(ctx context.Context, p PutPrm) error {
|
|||
|
||||
_, err := c.client.Invoke(ctx, prm)
|
||||
if err != nil {
|
||||
return fmt.Errorf("could not invoke method (%s): %w", method, err)
|
||||
return fmt.Errorf("invoke method (%s): %w", method, err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue