client: Remove status returning from processResponse function

Signed-off-by: Evgenii Baidakov <evgenii@nspcc.io>
This commit is contained in:
Evgenii Baidakov 2023-05-22 15:36:19 +04:00
parent b9ec85e5e3
commit e2a88bc258
No known key found for this signature in database
GPG key ID: 8733EE3D72CDB4DE
7 changed files with 12 additions and 17 deletions

View file

@ -206,14 +206,14 @@ func (x *contextCall) processResponse() bool {
}
// processResponse verifies response signature.
func (c *Client) processResponse(resp responseV2) (apistatus.Status, error) {
func (c *Client) processResponse(resp responseV2) error {
err := verifyServiceMessage(resp)
if err != nil {
return nil, fmt.Errorf("invalid response signature: %w", err)
return fmt.Errorf("invalid response signature: %w", err)
}
st := apistatus.FromStatusV2(resp.GetMetaHeader().GetStatus())
return st, apistatus.ErrFromStatus(st)
return apistatus.ErrFromStatus(st)
}
// reads response (if rResp is set) and processes it. Result means success.

View file

@ -217,8 +217,7 @@ func (c *Client) NetMapSnapshot(ctx context.Context, _ PrmNetMapSnapshot) (*ResN
}
var res ResNetMapSnapshot
_, err = c.processResponse(resp)
if err != nil {
if err = c.processResponse(resp); err != nil {
return nil, err
}

View file

@ -156,8 +156,7 @@ func (c *Client) ObjectDelete(ctx context.Context, prm PrmObjectDelete) (*ResObj
}
var res ResObjectDelete
_, err = c.processResponse(resp)
if err != nil {
if err = c.processResponse(resp); err != nil {
return nil, err
}

View file

@ -133,7 +133,7 @@ func (x *ObjectReader) ReadHeader(dst *object.Object) bool {
return false
}
_, x.err = x.client.processResponse(&resp)
x.err = x.client.processResponse(&resp)
if x.err != nil {
return false
}
@ -186,7 +186,7 @@ func (x *ObjectReader) readChunk(buf []byte) (int, bool) {
return read, false
}
_, x.err = x.client.processResponse(&resp)
x.err = x.client.processResponse(&resp)
if x.err != nil {
return read, false
}
@ -433,8 +433,7 @@ func (c *Client) ObjectHead(ctx context.Context, prm PrmObjectHead) (*ResObjectH
}
var res ResObjectHead
_, err = c.processResponse(resp)
if err != nil {
if err = c.processResponse(resp); err != nil {
return nil, err
}
@ -529,7 +528,7 @@ func (x *ObjectRangeReader) readChunk(buf []byte) (int, bool) {
return read, false
}
_, x.err = x.client.processResponse(&resp)
x.err = x.client.processResponse(&resp)
if x.err != nil {
return read, false
}

View file

@ -195,8 +195,7 @@ func (c *Client) ObjectHash(ctx context.Context, prm PrmObjectHash) (*ResObjectH
}
var res ResObjectHash
_, err = c.processResponse(resp)
if err != nil {
if err = c.processResponse(resp); err != nil {
return nil, err
}

View file

@ -206,8 +206,7 @@ func (x *ObjectWriter) Close() (*ResObjectPut, error) {
return nil, x.err
}
_, x.err = x.client.processResponse(&x.respV2)
if x.err != nil {
if x.err = x.client.processResponse(&x.respV2); x.err != nil {
return nil, x.err
}

View file

@ -125,7 +125,7 @@ func (x *ObjectListReader) Read(buf []oid.ID) (int, bool) {
return read, false
}
_, x.err = x.client.processResponse(&resp)
x.err = x.client.processResponse(&resp)
if x.err != nil {
return read, false
}