[#277] getsvc: Do not return status error

Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
This commit is contained in:
Dmitrii Stepanov 2023-04-20 10:58:43 +03:00 committed by Evgenii Stratonikov
parent 3bac5a485d
commit 8fc082b688
2 changed files with 8 additions and 10 deletions

View file

@ -128,10 +128,8 @@ func (exec *execCtx) GetObject(ctx context.Context, id oid.ID, rng *objectSDK.Ra
p.addr.SetContainer(exec.containerID())
p.addr.SetObject(id)
statusError := exec.svc.get(ctx, p.commonPrm, withPayloadRange(rng))
if statusError.err != nil {
return nil, statusError.err
if err := exec.svc.get(ctx, p.commonPrm, withPayloadRange(rng)); err != nil {
return nil, err
}
return w.Object(), nil
}

View file

@ -11,7 +11,7 @@ import (
// Get serves a request to get an object by address, and returns Streamer instance.
func (s *Service) Get(ctx context.Context, prm Prm) error {
return s.get(ctx, prm.commonPrm).err
return s.get(ctx, prm.commonPrm)
}
// GetRange serves a request to get an object by address, and returns Streamer instance.
@ -19,8 +19,8 @@ func (s *Service) GetRange(ctx context.Context, prm RangePrm) error {
return s.getRange(ctx, prm)
}
func (s *Service) getRange(ctx context.Context, prm RangePrm, opts ...execOption) error {
return s.get(ctx, prm.commonPrm, append(opts, withPayloadRange(prm.rng))...).err
func (s *Service) getRange(ctx context.Context, prm RangePrm) error {
return s.get(ctx, prm.commonPrm, withPayloadRange(prm.rng))
}
func (s *Service) GetRangeHash(ctx context.Context, prm RangeHashPrm) (*RangeHashRes, error) {
@ -60,10 +60,10 @@ func (s *Service) GetRangeHash(ctx context.Context, prm RangeHashPrm) (*RangeHas
// Returns ErrNotFound if the header was not received for the call.
// Returns SplitInfoError if object is virtual and raw flag is set.
func (s *Service) Head(ctx context.Context, prm HeadPrm) error {
return s.get(ctx, prm.commonPrm, headOnly()).err
return s.get(ctx, prm.commonPrm, headOnly())
}
func (s *Service) get(ctx context.Context, prm commonPrm, opts ...execOption) statusError {
func (s *Service) get(ctx context.Context, prm commonPrm, opts ...execOption) error {
exec := &execCtx{
svc: s,
prm: RangePrm{
@ -80,7 +80,7 @@ func (s *Service) get(ctx context.Context, prm commonPrm, opts ...execOption) st
exec.execute(ctx)
return exec.statusError
return exec.statusError.err
}
func (exec *execCtx) execute(ctx context.Context) {