forked from TrueCloudLab/frostfs-node
[#1247] container: Return ContainerNotFound
status error
Replace `core/container.ErrNotFound` error returned by `Source.Get` interface method with `apistatus.ContainerNotFound` status error. This error is returned by storage node's server as NeoFS API statuses. Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
70ffdf3478
commit
967650f2ed
5 changed files with 17 additions and 10 deletions
|
@ -11,8 +11,6 @@ var (
|
|||
ErrMalformedRequest = errors.New("malformed request")
|
||||
// ErrUnknownRole is returned when role of the sender is unknown.
|
||||
ErrUnknownRole = errors.New("can't classify request sender")
|
||||
// ErrUnknownContainer is returned when container fetching errors appeared.
|
||||
ErrUnknownContainer = errors.New("can't fetch container info")
|
||||
// ErrInvalidVerb is returned when session token verb doesn't include necessary operation.
|
||||
ErrInvalidVerb = errors.New("session token verb is invalid")
|
||||
)
|
||||
|
|
|
@ -2,6 +2,7 @@ package v2
|
|||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
|
||||
objectV2 "github.com/nspcc-dev/neofs-api-go/v2/object"
|
||||
|
@ -410,8 +411,10 @@ func (b Service) findRequestInfo(
|
|||
cid *cidSDK.ID,
|
||||
op eaclSDK.Operation) (info RequestInfo, err error) {
|
||||
cnr, err := b.containers.Get(cid) // fetch actual container
|
||||
if err != nil || cnr.OwnerID() == nil {
|
||||
return info, ErrUnknownContainer
|
||||
if err != nil {
|
||||
return info, err
|
||||
} else if cnr.OwnerID() == nil {
|
||||
return info, errors.New("missing owner in container descriptor")
|
||||
}
|
||||
|
||||
// find request role and key
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue