Bläddra i källkod

libnet/d/bridge: Change interface implemented by error types

- InvalidIPTablesCfgError: implement InternalError instead of
  BadRequestError. This error is returned when an invalid iptables
  action is passed as argument (ie. none of -A, -I, or -D).
- ErrInvalidDriverConfig: don't implement BadRequestError. This is
  returned when libnetwork controller initialization pass bad driver
  config -- there's no call from an HTTP route.

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
Albin Kerouanton 1 år sedan
förälder
incheckning
6d37ab0a83
1 ändrade filer med 2 tillägg och 5 borttagningar
  1. 2 5
      libnetwork/drivers/bridge/errors.go

+ 2 - 5
libnetwork/drivers/bridge/errors.go

@@ -24,9 +24,6 @@ func (eidc *ErrInvalidDriverConfig) Error() string {
 	return "Invalid configuration passed to Bridge Driver"
 }
 
-// BadRequest denotes the type of this error
-func (eidc *ErrInvalidDriverConfig) BadRequest() {}
-
 // ErrInvalidNetworkConfig error is returned when a network is created on a driver without valid config.
 type ErrInvalidNetworkConfig struct{}
 
@@ -229,8 +226,8 @@ func (action InvalidIPTablesCfgError) Error() string {
 	return fmt.Sprintf("Invalid IPTables action '%s'", string(action))
 }
 
-// BadRequest denotes the type of this error
-func (action InvalidIPTablesCfgError) BadRequest() {}
+// Internal denotes the type of this error
+func (action InvalidIPTablesCfgError) Internal() {}
 
 // IPv4AddrAddError is returned when IPv4 address could not be added to the bridge.
 type IPv4AddrAddError struct {