[#1561] object: Return OUT_OF_RANGE status

Replace `ErrRangeOutOfBounds` error from `pkg/core/object` package with
`ObjectOutOfRange` from `apistatus` package. That error is returned by
storage node's server as NeoFS API statuses.

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
This commit is contained in:
Pavel Karpy 2022-06-29 20:33:48 +03:00 committed by fyrchik
parent ccba07fe19
commit 9f7a22e2aa
11 changed files with 46 additions and 27 deletions

View file

@ -3,7 +3,6 @@ package getsvc
import (
"errors"
"github.com/nspcc-dev/neofs-node/pkg/core/object"
apistatus "github.com/nspcc-dev/neofs-sdk-go/client/status"
objectSDK "github.com/nspcc-dev/neofs-sdk-go/object"
"go.uber.org/zap"
@ -16,6 +15,7 @@ func (exec *execCtx) executeLocal() {
var errSplitInfo *objectSDK.SplitInfoError
var errRemoved apistatus.ObjectAlreadyRemoved
var errOutOfRange apistatus.ObjectOutOfRange
switch {
default:
@ -36,8 +36,8 @@ func (exec *execCtx) executeLocal() {
exec.status = statusVIRTUAL
mergeSplitInfo(exec.splitInfo(), errSplitInfo.SplitInfo())
exec.err = objectSDK.NewSplitInfoError(exec.infoSplit)
case errors.Is(err, object.ErrRangeOutOfBounds):
case errors.As(err, &errOutOfRange):
exec.status = statusOutOfRange
exec.err = object.ErrRangeOutOfBounds
exec.err = errOutOfRange
}
}