From 8931e99a18cc168ebee07bb72b62849815af7434 Mon Sep 17 00:00:00 2001 From: zhangguanzhang Date: Sun, 2 Aug 2020 21:08:13 +0800 Subject: API returns 500 in case network is not found instead of 404 Backported-by: Valentin Rothberg Signed-off-by: zhangguanzhang --- pkg/network/network.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'pkg/network/network.go') diff --git a/pkg/network/network.go b/pkg/network/network.go index cbebb0be8..37f3f721a 100644 --- a/pkg/network/network.go +++ b/pkg/network/network.go @@ -8,6 +8,7 @@ import ( "github.com/containernetworking/cni/pkg/types" "github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator" "github.com/containers/common/pkg/config" + "github.com/containers/libpod/v2/libpod/define" "github.com/containers/libpod/v2/pkg/util" "github.com/pkg/errors" "github.com/sirupsen/logrus" @@ -200,7 +201,7 @@ func InspectNetwork(config *config.Config, name string) (map[string]interface{}, func Exists(config *config.Config, name string) (bool, error) { _, err := ReadRawCNIConfByName(config, name) if err != nil { - if errors.Cause(err) == ErrNetworkNotFound { + if errors.Cause(err) == define.ErrNoSuchNetwork { return false, nil } return false, err -- cgit v1.2.3-54-g00ecf