Use errdefs package

This commit is contained in:
Brian Goff
2019-05-20 14:11:13 -07:00
parent 6743e4ff20
commit 6afc53f0e9
2 changed files with 4 additions and 4 deletions

4
eci.go
View File

@@ -17,7 +17,7 @@ import (
"time"
"github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests"
"github.com/cpuguy83/strongerrors"
"github.com/virtual-kubelet/virtual-kubelet/errdefs"
"github.com/virtual-kubelet/virtual-kubelet/log"
"github.com/virtual-kubelet/virtual-kubelet/manager"
"github.com/virtual-kubelet/virtual-kubelet/providers/alibabacloud/eci"
@@ -254,7 +254,7 @@ func (p *ECIProvider) DeletePod(ctx context.Context, pod *v1.Pod) error {
}
}
if eciId == "" {
return strongerrors.NotFound(fmt.Errorf("DeletePod can't find Pod %s-%s", pod.Namespace, pod.Name))
return errdefs.NotFoundf("DeletePod can't find Pod %s-%s", pod.Namespace, pod.Name)
}
request := eci.CreateDeleteContainerGroupRequest()

View File

@@ -4,7 +4,7 @@ import (
"net/http"
"github.com/aliyun/alibaba-cloud-sdk-go/sdk/errors"
"github.com/cpuguy83/strongerrors"
"github.com/virtual-kubelet/virtual-kubelet/errdefs"
)
func wrapError(err error) error {
@@ -19,7 +19,7 @@ func wrapError(err error) error {
switch se.HttpStatus() {
case http.StatusNotFound:
return strongerrors.NotFound(err)
return errdefs.AsNotFound(err)
default:
return err
}