mirror of
https://github.com/moby/moby.git
synced 2026-08-09 01:21:37 +00:00
libnetwork/drivers/bridge: remove ErrInvalidDriverConfig
It's a generic error, doesn't implement an errdefs type, is poorly formatted,
and not used as sentinel error anywhere. Let's remove it, and update the error
produced to be slightly more informative (include the invalid type). Worth
noting that there's no need to include the name of the driver in the error,
because the only uses of the error (in `registerNetworkDrivers`) already
decorates it; 5fd7ed2937/libnetwork/drivers_linux.go (L34-L36)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
@@ -499,7 +499,7 @@ func (d *driver) configure(option map[string]interface{}) error {
|
||||
case nil:
|
||||
// No GenericData option set. Use defaults.
|
||||
default:
|
||||
return &ErrInvalidDriverConfig{}
|
||||
return errdefs.InvalidParameter(fmt.Errorf("invalid configuration type (%T) passed", opt))
|
||||
}
|
||||
|
||||
if config.EnableIPTables {
|
||||
|
||||
@@ -17,13 +17,6 @@ func (ece *ErrConfigExists) Error() string {
|
||||
// Forbidden denotes the type of this error
|
||||
func (ece *ErrConfigExists) Forbidden() {}
|
||||
|
||||
// ErrInvalidDriverConfig error is returned when Bridge Driver is passed an invalid config
|
||||
type ErrInvalidDriverConfig struct{}
|
||||
|
||||
func (eidc *ErrInvalidDriverConfig) Error() string {
|
||||
return "Invalid configuration passed to Bridge Driver"
|
||||
}
|
||||
|
||||
// ErrInvalidNetworkConfig error is returned when a network is created on a driver without valid config.
|
||||
type ErrInvalidNetworkConfig struct{}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user