Reused errdefs for error

Signed-off-by: xin.li <xin.li@daocloud.io>
This commit is contained in:
xin.li 2023-01-02 21:39:14 +08:00
parent d769f03592
commit 1753e5af7a
2 changed files with 8 additions and 8 deletions

View File

@ -33,7 +33,7 @@ limitations under the License.
package bandwidth
import (
"errors"
"github.com/containerd/containerd/errdefs"
"k8s.io/apimachinery/pkg/api/resource"
)
@ -47,7 +47,7 @@ type FakeShaper struct {
// Limit is not implemented
func (f *FakeShaper) Limit(cidr string, egress, ingress *resource.Quantity) error {
return errors.New("unimplemented")
return errdefs.ErrNotImplemented
}
// Reset appends a particular CIDR to the set of ResetCIDRs being managed by this shaper
@ -58,12 +58,12 @@ func (f *FakeShaper) Reset(cidr string) error {
// ReconcileInterface is not implemented
func (f *FakeShaper) ReconcileInterface() error {
return errors.New("unimplemented")
return errdefs.ErrNotImplemented
}
// ReconcileCIDR is not implemented
func (f *FakeShaper) ReconcileCIDR(cidr string, egress, ingress *resource.Quantity) error {
return errors.New("unimplemented")
return errdefs.ErrNotImplemented
}
// GetCIDRs returns the set of CIDRs that are being managed by this shaper

View File

@ -35,7 +35,7 @@ limitations under the License.
package bandwidth
import (
"errors"
"github.com/containerd/containerd/errdefs"
"k8s.io/apimachinery/pkg/api/resource"
)
@ -49,7 +49,7 @@ func NewTCShaper(iface string) Shaper {
}
func (f *unsupportedShaper) Limit(cidr string, egress, ingress *resource.Quantity) error {
return errors.New("unimplemented")
return errdefs.ErrNotImplemented
}
func (f *unsupportedShaper) Reset(cidr string) error {
@ -57,11 +57,11 @@ func (f *unsupportedShaper) Reset(cidr string) error {
}
func (f *unsupportedShaper) ReconcileInterface() error {
return errors.New("unimplemented")
return errdefs.ErrNotImplemented
}
func (f *unsupportedShaper) ReconcileCIDR(cidr string, egress, ingress *resource.Quantity) error {
return errors.New("unimplemented")
return errdefs.ErrNotImplemented
}
func (f *unsupportedShaper) GetCIDRs() ([]string, error) {