Merge pull request #103059 from rajaSahil/fix-error

Update github.com/pkg/errors to go native errors pkg
This commit is contained in:
Kubernetes Prow Robot 2021-08-17 10:29:25 -07:00 committed by GitHub
commit b559434c02
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 6 additions and 9 deletions

View File

@ -17,12 +17,11 @@ limitations under the License.
package configfiles
import (
"errors"
"fmt"
"path/filepath"
"testing"
"github.com/pkg/errors"
apiequality "k8s.io/apimachinery/pkg/api/equality"
"k8s.io/apimachinery/pkg/runtime"
kubeletconfigv1beta1 "k8s.io/kubelet/config/v1beta1"
@ -166,7 +165,7 @@ foo: bar`),
}
kc, err := loader.Load()
if c.strictErr && !runtime.IsStrictDecodingError(errors.Cause(err)) {
if c.strictErr && !runtime.IsStrictDecodingError(errors.Unwrap(err)) {
t.Fatalf("got error: %v, want strict decoding error", err)
}
if utiltest.SkipRest(t, c.desc, err, c.err) {

View File

@ -19,7 +19,6 @@ package codec
import (
"fmt"
"github.com/pkg/errors"
"k8s.io/klog/v2"
// ensure the core apis are installed
@ -95,7 +94,7 @@ func DecodeKubeletConfiguration(kubeletCodecs *serializer.CodecFactory, data []b
// decoder, which has only v1beta1 registered, and log a warning.
// The lenient path is to be dropped when support for v1beta1 is dropped.
if !runtime.IsStrictDecodingError(err) {
return nil, errors.Wrap(err, "failed to decode")
return nil, fmt.Errorf("failed to decode: %w", err)
}
var lenientErr error

View File

@ -22,13 +22,13 @@ package operationexecutor
import (
"context"
"errors"
"fmt"
"net"
"time"
"k8s.io/klog/v2"
"github.com/pkg/errors"
"google.golang.org/grpc"
"k8s.io/client-go/tools/record"
registerapi "k8s.io/kubelet/pkg/apis/pluginregistration/v1"
@ -163,7 +163,7 @@ func (og *operationGenerator) notifyPlugin(client registerapi.RegistrationClient
}
if _, err := client.NotifyRegistrationStatus(ctx, status); err != nil {
return errors.Wrap(err, errStr)
return fmt.Errorf("%s: %w", errStr, err)
}
if errStr != "" {

View File

@ -23,7 +23,6 @@ import (
restful "github.com/emicklei/go-restful"
cadvisorapi "github.com/google/cadvisor/info/v1"
cadvisorv2 "github.com/google/cadvisor/info/v2"
"github.com/pkg/errors"
"k8s.io/klog/v2"
"k8s.io/api/core/v1"
@ -143,7 +142,7 @@ func (h *handler) handleSummary(request *restful.Request, response *restful.Resp
onlyCPUAndMemory := false
err := request.Request.ParseForm()
if err != nil {
handleError(response, "/stats/summary", errors.Wrapf(err, "parse form failed"))
handleError(response, "/stats/summary", fmt.Errorf("parse form failed: %w", err))
return
}
if onlyCluAndMemoryParam, found := request.Request.Form["only_cpu_and_memory"]; found &&