[#xxx] client: Return status from all methods
Since status is checked first in handleError method, it should be returned from client methods Signed-off-by: Marina Biryukova <m.biryukova@yadro.com>
This commit is contained in:
parent
a7aabe5349
commit
9e67c471df
7 changed files with 12 additions and 32 deletions
|
@ -65,7 +65,7 @@ func (c *Client) APEManagerListChains(ctx context.Context, prm PrmAPEManagerList
|
||||||
var res ResAPEManagerListChains
|
var res ResAPEManagerListChains
|
||||||
res.st, err = c.processResponse(resp)
|
res.st, err = c.processResponse(resp)
|
||||||
if err != nil || !apistatus.IsSuccessful(res.st) {
|
if err != nil || !apistatus.IsSuccessful(res.st) {
|
||||||
return nil, err
|
return &res, err
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, ch := range resp.GetBody().GetChains() {
|
for _, ch := range resp.GetBody().GetChains() {
|
||||||
|
|
|
@ -239,12 +239,8 @@ func (c *Client) NetMapSnapshot(ctx context.Context, _ PrmNetMapSnapshot) (*ResN
|
||||||
|
|
||||||
var res ResNetMapSnapshot
|
var res ResNetMapSnapshot
|
||||||
res.st, err = c.processResponse(resp)
|
res.st, err = c.processResponse(resp)
|
||||||
if err != nil {
|
if err != nil || !apistatus.IsSuccessful(res.st) {
|
||||||
return nil, err
|
return &res, err
|
||||||
}
|
|
||||||
|
|
||||||
if !apistatus.IsSuccessful(res.st) {
|
|
||||||
return &res, nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const fieldNetMap = "network map"
|
const fieldNetMap = "network map"
|
||||||
|
|
|
@ -148,12 +148,8 @@ func (c *Client) ObjectDelete(ctx context.Context, prm PrmObjectDelete) (*ResObj
|
||||||
|
|
||||||
var res ResObjectDelete
|
var res ResObjectDelete
|
||||||
res.st, err = c.processResponse(resp)
|
res.st, err = c.processResponse(resp)
|
||||||
if err != nil {
|
if err != nil || !apistatus.IsSuccessful(res.st) {
|
||||||
return nil, err
|
return &res, err
|
||||||
}
|
|
||||||
|
|
||||||
if !apistatus.IsSuccessful(res.st) {
|
|
||||||
return &res, nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const fieldTombstone = "tombstone"
|
const fieldTombstone = "tombstone"
|
||||||
|
|
|
@ -492,12 +492,8 @@ func (c *Client) ObjectHead(ctx context.Context, prm PrmObjectHead) (*ResObjectH
|
||||||
|
|
||||||
var res ResObjectHead
|
var res ResObjectHead
|
||||||
res.st, err = c.processResponse(resp)
|
res.st, err = c.processResponse(resp)
|
||||||
if err != nil {
|
if err != nil || !apistatus.IsSuccessful(res.st) {
|
||||||
return nil, err
|
return &res, err
|
||||||
}
|
|
||||||
|
|
||||||
if !apistatus.IsSuccessful(res.st) {
|
|
||||||
return &res, nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
res.idObj = *prm.ObjectID
|
res.idObj = *prm.ObjectID
|
||||||
|
|
|
@ -189,12 +189,8 @@ func (c *Client) ObjectHash(ctx context.Context, prm PrmObjectHash) (*ResObjectH
|
||||||
|
|
||||||
var res ResObjectHash
|
var res ResObjectHash
|
||||||
res.st, err = c.processResponse(resp)
|
res.st, err = c.processResponse(resp)
|
||||||
if err != nil {
|
if err != nil || !apistatus.IsSuccessful(res.st) {
|
||||||
return nil, err
|
return &res, err
|
||||||
}
|
|
||||||
|
|
||||||
if !apistatus.IsSuccessful(res.st) {
|
|
||||||
return &res, nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
res.checksums = resp.GetBody().GetHashList()
|
res.checksums = resp.GetBody().GetHashList()
|
||||||
|
|
|
@ -156,12 +156,8 @@ func (x *objectWriterRaw) Close(_ context.Context) (*ResObjectPut, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
x.res.st, x.err = x.client.processResponse(&x.respV2)
|
x.res.st, x.err = x.client.processResponse(&x.respV2)
|
||||||
if x.err != nil {
|
if x.err != nil || !apistatus.IsSuccessful(x.res.st) {
|
||||||
return nil, x.err
|
return &x.res, x.err
|
||||||
}
|
|
||||||
|
|
||||||
if !apistatus.IsSuccessful(x.res.st) {
|
|
||||||
return &x.res, nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const fieldID = "ID"
|
const fieldID = "ID"
|
||||||
|
|
|
@ -167,7 +167,7 @@ func (c *Client) ObjectPutSingle(ctx context.Context, prm PrmObjectPutSingle) (*
|
||||||
var res ResObjectPutSingle
|
var res ResObjectPutSingle
|
||||||
res.st, err = c.processResponse(resp)
|
res.st, err = c.processResponse(resp)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return &res, err
|
||||||
}
|
}
|
||||||
res.epoch = resp.GetMetaHeader().GetEpoch()
|
res.epoch = resp.GetMetaHeader().GetEpoch()
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue