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:
Sebastiaan van Stijn
2025-01-28 12:42:32 +01:00
parent 47dc8d5dd8
commit 59c2d2a4b3
2 changed files with 1 additions and 8 deletions

View File

@@ -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 {

View File

@@ -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{}