From 4caa330ddc1b394cf4dd10b01859e7f2da5e59a0 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Tue, 8 Feb 2022 11:25:11 +0300 Subject: [PATCH] [#1115] morph/client: reuse errors from container contract Signed-off-by: Evgenii Stratonikov --- go.mod | 1 + go.sum | Bin 93629 -> 93820 bytes pkg/morph/client/container/get.go | 10 ++-------- 3 files changed, 3 insertions(+), 8 deletions(-) diff --git a/go.mod b/go.mod index b01bcf2c..8b3a9236 100644 --- a/go.mod +++ b/go.mod @@ -15,6 +15,7 @@ require ( github.com/nspcc-dev/hrw v1.0.9 github.com/nspcc-dev/neo-go v0.98.0 github.com/nspcc-dev/neofs-api-go/v2 v2.11.2-0.20220127135316-32dd0bb3f9c5 + github.com/nspcc-dev/neofs-contract v0.14.2 github.com/nspcc-dev/neofs-sdk-go v0.0.0-20220201141054-6a7ba33b59ef github.com/nspcc-dev/tzhash v1.5.1 github.com/panjf2000/ants/v2 v2.4.0 diff --git a/go.sum b/go.sum index 587110c2f1dcfbe44c169a94123b73240e325c85..5b253f9a4ad86b9d4ad2c72a188ecd175e5c1c0b 100644 GIT binary patch delta 160 zcmdmcoAu8f)(u~K?eg%S zibG9;1B%VegVI8rgUteiD>Dk6vz;9$J5G>wOGYz8KRsVBH$MerRC%zYK~Anqp=(fa wl7UZga6pBBRd!^kPf>_-qJOfbSCqS%fn}+mpHo#b$f(J@{al;>_3pn90P$xz5&!@I delta 18 acmex!hjs65)(u~KC!g)-+`PAM|9t>zc?&@R diff --git a/pkg/morph/client/container/get.go b/pkg/morph/client/container/get.go index 9a91dcf2..bc25e596 100644 --- a/pkg/morph/client/container/get.go +++ b/pkg/morph/client/container/get.go @@ -4,6 +4,7 @@ import ( "fmt" "strings" + containerContract "github.com/nspcc-dev/neofs-contract/container" core "github.com/nspcc-dev/neofs-node/pkg/core/container" "github.com/nspcc-dev/neofs-node/pkg/morph/client" "github.com/nspcc-dev/neofs-sdk-go/container" @@ -43,14 +44,7 @@ func (c *Client) Get(cid []byte) (*container.Container, error) { res, err := c.client.TestInvoke(prm) if err != nil { - // TODO(fyrchik): reuse messages from container contract. - // Currently there are some dependency problems: - // github.com/nspcc-dev/neofs-node/pkg/innerring imports - // github.com/nspcc-dev/neofs-sdk-go/audit imports - // github.com/nspcc-dev/neofs-api-go/v2/audit: ambiguous import: found package github.com/nspcc-dev/neofs-api-go/v2/audit in multiple modules: - // github.com/nspcc-dev/neofs-api-go v1.27.1 (/home/dzeta/go/pkg/mod/github.com/nspcc-dev/neofs-api-go@v1.27.1/v2/audit) - // github.com/nspcc-dev/neofs-api-go/v2 v2.11.0-pre.0.20211201134523-3604d96f3fe1 (/home/dzeta/go/pkg/mod/github.com/nspcc-dev/neofs-api-go/v2@v2.11.0-pre.0.20211201134523-3604d96f3fe1/audit) - if strings.Contains(err.Error(), "container does not exist") { + if strings.Contains(err.Error(), containerContract.NotFoundError) { return nil, core.ErrNotFound } return nil, fmt.Errorf("could not perform test invocation (%s): %w", getMethod, err)