Use errdefs package
This commit is contained in:
4
eci.go
4
eci.go
@@ -17,7 +17,7 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests"
|
"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/log"
|
||||||
"github.com/virtual-kubelet/virtual-kubelet/manager"
|
"github.com/virtual-kubelet/virtual-kubelet/manager"
|
||||||
"github.com/virtual-kubelet/virtual-kubelet/providers/alibabacloud/eci"
|
"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 == "" {
|
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()
|
request := eci.CreateDeleteContainerGroupRequest()
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"github.com/aliyun/alibaba-cloud-sdk-go/sdk/errors"
|
"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 {
|
func wrapError(err error) error {
|
||||||
@@ -19,7 +19,7 @@ func wrapError(err error) error {
|
|||||||
|
|
||||||
switch se.HttpStatus() {
|
switch se.HttpStatus() {
|
||||||
case http.StatusNotFound:
|
case http.StatusNotFound:
|
||||||
return strongerrors.NotFound(err)
|
return errdefs.AsNotFound(err)
|
||||||
default:
|
default:
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user