Browse Source

libnet/d/bridge: Inline InvalidIPTablesCfgError

This error can only be reached because of an error in our code, so it's
not a "bad user request". As it's never type asserted, no need to keep
it around.

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
Albin Kerouanton 1 year ago
parent
commit
7c13985fa1
2 changed files with 1 additions and 11 deletions
  1. 0 10
      libnetwork/drivers/bridge/errors.go
  2. 1 1
      libnetwork/drivers/bridge/link.go

+ 0 - 10
libnetwork/drivers/bridge/errors.go

@@ -209,16 +209,6 @@ func (fcv6 *FixedCIDRv6Error) Error() string {
 // InternalError denotes the type of this error
 func (fcv6 *FixedCIDRv6Error) InternalError() {}
 
-// InvalidIPTablesCfgError is returned when an invalid ip tables configuration is entered
-type InvalidIPTablesCfgError string
-
-func (action InvalidIPTablesCfgError) Error() string {
-	return fmt.Sprintf("Invalid IPTables action '%s'", string(action))
-}
-
-// 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 {
 	IP  *net.IPNet

+ 1 - 1
libnetwork/drivers/bridge/link.go

@@ -63,7 +63,7 @@ func linkContainers(action, parentIP, childIP string, ports []types.TransportPor
 	case "-D":
 		nfAction = iptables.Delete
 	default:
-		return InvalidIPTablesCfgError(action)
+		return fmt.Errorf("invalid iptables action: %s", action)
 	}
 
 	ip1 := net.ParseIP(parentIP)