Check for an error before checking for nil.

The error object, if it exists, probably has more specific information
to hand to the caller.
This commit is contained in:
Matt Liggett 2016-06-20 17:03:17 -07:00
parent a3f09700e5
commit 3659c6ff32

View File

@ -283,12 +283,12 @@ func (s *ServiceController) ensureDnsRecords(clusterName string, cachedService *
serviceName := cachedService.lastState.Name
namespaceName := cachedService.lastState.Namespace
zoneNames, regionName, err := s.getClusterZoneNames(clusterName)
if zoneNames == nil {
return fmt.Errorf("fail to get cluster zone names")
}
if err != nil {
return err
}
if zoneNames == nil {
return fmt.Errorf("failed to get cluster zone names")
}
dnsZoneName, err := s.getFederationDNSZoneName()
if err != nil {
return err