From e6d823da7159d5c171d3daaed2d44c68a91bc813 Mon Sep 17 00:00:00 2001 From: Brendan Burns Date: Fri, 3 Oct 2014 15:08:16 -0700 Subject: [PATCH] Use formal error checking to validate a not found err. --- pkg/service/endpoints_controller.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/service/endpoints_controller.go b/pkg/service/endpoints_controller.go index 06068a0b275..b259993dafa 100644 --- a/pkg/service/endpoints_controller.go +++ b/pkg/service/endpoints_controller.go @@ -20,9 +20,9 @@ import ( "fmt" "net" "strconv" - "strings" "github.com/GoogleCloudPlatform/kubernetes/pkg/api" + "github.com/GoogleCloudPlatform/kubernetes/pkg/api/errors" "github.com/GoogleCloudPlatform/kubernetes/pkg/client" "github.com/GoogleCloudPlatform/kubernetes/pkg/labels" "github.com/GoogleCloudPlatform/kubernetes/pkg/registry/service" @@ -78,7 +78,7 @@ func (e *EndpointController) SyncServiceEndpoints() error { currentEndpoints, err := e.client.GetEndpoints(nsCtx, service.ID) if err != nil { // TODO this is brittle as all get out, refactor the client libraries to return a structured error. - if strings.Contains(err.Error(), "not found") { + if errors.IsNotFound(err) { currentEndpoints = &api.Endpoints{ JSONBase: api.JSONBase{ ID: service.ID,