libnetwork/types: remove ErrInvalidProtocolBinding
It was not used as a sentinel error, and didn't carry a specific type, which made it a rather complex way to create an error. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
4445169cb5
commit
d9b7a5f01a
1 changed files with 2 additions and 9 deletions
|
@ -86,7 +86,7 @@ func (p PortBinding) HostAddr() (net.Addr, error) {
|
|||
case SCTP:
|
||||
return &sctp.SCTPAddr{IPAddrs: []net.IPAddr{{IP: p.HostIP}}, Port: int(p.HostPort)}, nil
|
||||
default:
|
||||
return nil, ErrInvalidProtocolBinding(p.Proto.String())
|
||||
return nil, fmt.Errorf("invalid transport protocol: %s", p.Proto.String())
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -100,7 +100,7 @@ func (p PortBinding) ContainerAddr() (net.Addr, error) {
|
|||
case SCTP:
|
||||
return &sctp.SCTPAddr{IPAddrs: []net.IPAddr{{IP: p.IP}}, Port: int(p.Port)}, nil
|
||||
default:
|
||||
return nil, ErrInvalidProtocolBinding(p.Proto.String())
|
||||
return nil, fmt.Errorf("invalid transport protocol: %s", p.Proto.String())
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -130,13 +130,6 @@ func (p *PortBinding) String() string {
|
|||
return ret
|
||||
}
|
||||
|
||||
// ErrInvalidProtocolBinding is returned when the port binding protocol is not valid.
|
||||
type ErrInvalidProtocolBinding string
|
||||
|
||||
func (ipb ErrInvalidProtocolBinding) Error() string {
|
||||
return fmt.Sprintf("invalid transport protocol: %s", string(ipb))
|
||||
}
|
||||
|
||||
const (
|
||||
// ICMP is for the ICMP ip protocol
|
||||
ICMP = 1
|
||||
|
|
Loading…
Reference in a new issue