Detect type conversion failure

This commit is contained in:
Sean Chittenden 2016-04-23 17:17:07 -07:00
parent c92f9cb9ab
commit e54c990f50

View File

@ -511,7 +511,10 @@ func (c *ConsulBackend) DetectHostAddr() (string, error) {
if err != nil {
return "", err
}
addr := self["Member"]["Addr"].(string)
addr, ok := self["Member"]["Addr"].(string)
if !ok {
return "", fmt.Errorf("Unable to convert an address to string")
}
return addr, nil
}