Skip to content

Commit 566c26f

Browse files
committed
Fix find by name
1 parent ad53202 commit 566c26f

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

serverscom/loadbalancers.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,14 @@ func (l *loadBalancers) findLoadBalancerByName(ctx context.Context, clusterName
184184
}
185185
}
186186

187+
if currentLoadBalancer == nil {
188+
return nil, &cli.NotFoundError{
189+
StatusCode: 404,
190+
ErrorCode: "NOT_FOUND",
191+
Message: fmt.Sprintf("No load balancers were found with name: %s", name),
192+
}
193+
}
194+
187195
return l.client.LoadBalancers.GetL4LoadBalancer(ctx, currentLoadBalancer.ID)
188196
}
189197

0 commit comments

Comments
 (0)