Skip to content

Commit f2597fe

Browse files
openstackcluster_controller: Fix error message
Avoid wrapping `<nil>` in the error message if there is no error to wrap.
1 parent 407baac commit f2597fe

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

controllers/openstackcluster_controller.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -447,12 +447,12 @@ func reconcileNetworkComponents(scope scope.Scope, cluster *clusterv1.Cluster, o
447447
return fmt.Errorf("failed to find network: %w", err)
448448
}
449449
if len(networkList) == 0 {
450-
handleUpdateOSCError(openStackCluster, fmt.Errorf("failed to find any network: %w", err))
451-
return fmt.Errorf("failed to find any network: %w", err)
450+
handleUpdateOSCError(openStackCluster, fmt.Errorf("failed to find any network"))
451+
return fmt.Errorf("failed to find any network")
452452
}
453453
if len(networkList) > 1 {
454-
handleUpdateOSCError(openStackCluster, fmt.Errorf("failed to find only one network (result: %v): %w", networkList, err))
455-
return fmt.Errorf("failed to find only one network (result: %v): %w", networkList, err)
454+
handleUpdateOSCError(openStackCluster, fmt.Errorf("found multiple networks (result: %v)", networkList))
455+
return fmt.Errorf("found multiple networks (result: %v)", networkList)
456456
}
457457
if openStackCluster.Status.Network == nil {
458458
openStackCluster.Status.Network = &infrav1.Network{}

0 commit comments

Comments
 (0)