Skip to content

Commit 559156c

Browse files
committed
Added error checking to pagination calls
1 parent 9735a85 commit 559156c

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

pkg/aws/albelbv2/elbv2.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,14 @@ func (e *ELBV2) ClusterLoadBalancers(rgt *albrgt.Resources) ([]*elbv2.LoadBalanc
148148
},
149149
}
150150

151+
if p.Err() != nil {
152+
return nil, p.Err()
153+
}
154+
151155
for p.Next() {
156+
if p.Err() != nil {
157+
return nil, p.Err()
158+
}
152159
page := p.Page().(*elbv2.DescribeLoadBalancersOutput)
153160

154161
for _, loadBalancer := range page.LoadBalancers {
@@ -174,7 +181,15 @@ func (e *ELBV2) ClusterTargetGroups(rgt *albrgt.Resources) (map[string][]*elbv2.
174181
},
175182
}
176183

184+
if p.Err() != nil {
185+
return nil, p.Err()
186+
}
187+
177188
for p.Next() {
189+
if p.Err() != nil {
190+
return nil, p.Err()
191+
}
192+
178193
page := p.Page().(*elbv2.DescribeTargetGroupsOutput)
179194

180195
for _, targetGroup := range page.TargetGroups {

pkg/aws/albrgt/rgt.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,14 @@ func (r *RGT) GetResources(clusterName *string) (*Resources, error) {
6868
},
6969
}
7070

71+
if p.Err() != nil {
72+
return nil, p.Err()
73+
}
74+
7175
for p.Next() {
76+
if p.Err() != nil {
77+
return nil, p.Err()
78+
}
7279
page := p.Page().(*resourcegroupstaggingapi.GetResourcesOutput)
7380
for _, rtm := range page.ResourceTagMappingList {
7481
switch {

0 commit comments

Comments
 (0)