Files
moby/libnetwork/drivers/bridge/errors.go
Sebastiaan van Stijn 7012e3ce14 libnetwork/drivers/bridge: remove NonDefaultBridgeExistError
It was only used in a single place, and a generic errdefs.ErrInvalid; the
type itself was not used as sentinel error other than for a unit test.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-01-28 19:10:15 +01:00

47 lines
1.3 KiB
Go

//go:build linux
package bridge
import (
"errors"
"fmt"
"github.com/docker/docker/errdefs"
)
// errInvalidGateway is returned when the user provided default gateway (v4/v6) is not valid.
var errInvalidGateway = errdefs.InvalidParameter(errors.New("default gateway ip must be part of the network"))
// InvalidNetworkIDError is returned when the passed
// network id for an existing network is not a known id.
type InvalidNetworkIDError string
func (inie InvalidNetworkIDError) Error() string {
return fmt.Sprintf("invalid network id %s", string(inie))
}
// NotFound denotes the type of this error
func (inie InvalidNetworkIDError) NotFound() {}
// InvalidEndpointIDError is returned when the passed
// endpoint id is not valid.
type InvalidEndpointIDError string
func (ieie InvalidEndpointIDError) Error() string {
return fmt.Sprintf("invalid endpoint id: %s", string(ieie))
}
// InvalidParameter denotes the type of this error
func (ieie InvalidEndpointIDError) InvalidParameter() {}
// EndpointNotFoundError is returned when the no endpoint
// with the passed endpoint id is found.
type EndpointNotFoundError string
func (enfe EndpointNotFoundError) Error() string {
return fmt.Sprintf("endpoint not found: %s", string(enfe))
}
// NotFound denotes the type of this error
func (enfe EndpointNotFoundError) NotFound() {}