File tree Expand file tree Collapse file tree 2 files changed +24
-3
lines changed Expand file tree Collapse file tree 2 files changed +24
-3
lines changed Original file line number Diff line number Diff line change @@ -249,9 +249,14 @@ func (n *Nuke) HandleQueue() {
249
249
n .HandleRemove (item )
250
250
item .Print ()
251
251
case ItemStateFailed :
252
- n .HandleRemove (item )
253
- n .HandleWait (item , listCache )
254
- item .Print ()
252
+ // item.Resource will be nil if an exception was thrown while retrieving the resourceType's
253
+ // items (I.E resourceTypes lister()), however we still pass down the reason and state so we
254
+ // aren't ignoring these exceptions.
255
+ if item .Resource != nil {
256
+ n .HandleRemove (item )
257
+ n .HandleWait (item , listCache )
258
+ item .Print ()
259
+ }
255
260
case ItemStatePending :
256
261
n .HandleWait (item , listCache )
257
262
item .State = ItemStateWaiting
Original file line number Diff line number Diff line change 5
5
"fmt"
6
6
"runtime/debug"
7
7
8
+ "github.com/aws/aws-sdk-go/aws/awserr"
8
9
"github.com/rebuy-de/aws-nuke/v2/pkg/awsutil"
9
10
"github.com/rebuy-de/aws-nuke/v2/pkg/util"
10
11
"github.com/rebuy-de/aws-nuke/v2/resources"
@@ -72,6 +73,21 @@ func (s *scanner) list(region *Region, resourceType string) {
72
73
return
73
74
}
74
75
76
+ // check for this error "ThrottlingException: Rate exceeded"
77
+ // TODO: if there is a throttling exception call lister(sess) again 3 times with exponential backoff.
78
+ // or maybe try recursion and call s.list(region, resourceType)
79
+ awsErr , ok := err .(awserr.Error )
80
+ if ok && awsErr .Code () == "ThrottlingException" {
81
+ s .items <- & Item {
82
+ Region : region ,
83
+ Resource : nil ,
84
+ State : ItemStateFailed ,
85
+ Reason : err .Error (),
86
+ Type : resourceType ,
87
+ }
88
+ return
89
+ }
90
+
75
91
dump := util .Indent (fmt .Sprintf ("%v" , err ), " " )
76
92
log .Errorf ("Listing %s failed:\n %s" , resourceType , dump )
77
93
return
You can’t perform that action at this time.
0 commit comments