Consolidate invalid address log (#2063)

The Invalid listen address errors should be as
same as Invalid advertise address.

Signed-off-by: Kien Nguyen <kiennt2609@gmail.com>
This commit is contained in:
Kien Nguyen-Tuan 2019-10-11 19:05:06 +07:00 committed by Simon Pasquier
parent f3a2ff8b7f
commit ca3893058c
1 changed files with 3 additions and 3 deletions

View File

@ -121,11 +121,11 @@ func Create(
) (*Peer, error) {
bindHost, bindPortStr, err := net.SplitHostPort(bindAddr)
if err != nil {
return nil, err
return nil, errors.Wrap(err, "invalid listen address")
}
bindPort, err := strconv.Atoi(bindPortStr)
if err != nil {
return nil, errors.Wrap(err, "invalid listen address")
return nil, errors.Wrapf(err, "address %s: invalid port", bindAddr)
}
var advertiseHost string
@ -138,7 +138,7 @@ func Create(
}
advertisePort, err = strconv.Atoi(advertisePortStr)
if err != nil {
return nil, errors.Wrap(err, "invalid advertise address, wrong port")
return nil, errors.Wrapf(err, "address %s: invalid port", advertiseAddr)
}
}