[#140] apistatus: Support CONTAINER_NOT_FOUND error

Define `ContainerNotFound` type for `CONTAINER_NOT_FOUND` code.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
Leonard Lyubich 2022-02-28 11:55:25 +03:00 committed by LeL
parent f1e46d35de
commit c627648798
3 changed files with 55 additions and 0 deletions

View file

@ -3,6 +3,7 @@ package apistatus
import (
"fmt"
"github.com/nspcc-dev/neofs-api-go/v2/container"
"github.com/nspcc-dev/neofs-api-go/v2/object"
"github.com/nspcc-dev/neofs-api-go/v2/status"
)
@ -67,6 +68,12 @@ func FromStatusV2(st *status.Status) Status {
case object.StatusAlreadyRemoved:
decoder = new(ObjectAlreadyRemoved)
}
case container.LocalizeFailStatus(&code):
//nolint:exhaustive
switch code {
case container.StatusNotFound:
decoder = new(ContainerNotFound)
}
}
if decoder == nil {