File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -358,11 +358,28 @@ func (m SQSMonitor) getNodeInfo(instanceID string) (*NodeInfo, error) {
358358 },
359359 })
360360 if err != nil {
361+ // handle all kinds of InvalidInstanceID error events
362+ // - https://docs.aws.amazon.com/AWSEC2/latest/APIReference/errors-overview.html
363+ if aerr , ok := err .(awserr.Error ); ok && aerr .Code () == "InvalidInstanceID" {
364+ msg := fmt .Sprintf ("Invalid instance id %s provided" , instanceID )
365+ log .Warn ().Msg (msg )
366+ return nil , skip {fmt .Errorf (msg )}
367+ }
361368 if aerr , ok := err .(awserr.Error ); ok && aerr .Code () == "InvalidInstanceID.NotFound" {
362369 msg := fmt .Sprintf ("No instance found with instance-id %s" , instanceID )
363370 log .Warn ().Msg (msg )
364371 return nil , skip {fmt .Errorf (msg )}
365372 }
373+ if aerr , ok := err .(awserr.Error ); ok && aerr .Code () == "InvalidInstanceID.Malformed" {
374+ msg := fmt .Sprintf ("Malformed instance-id %s" , instanceID )
375+ log .Warn ().Msg (msg )
376+ return nil , skip {fmt .Errorf (msg )}
377+ }
378+ if aerr , ok := err .(awserr.Error ); ok && aerr .Code () == "InvalidInstanceID.NotLinkable" {
379+ msg := fmt .Sprintf ("Instance-id %s not linkable" , instanceID )
380+ log .Warn ().Msg (msg )
381+ return nil , skip {fmt .Errorf (msg )}
382+ }
366383 return nil , err
367384 }
368385 if len (result .Reservations ) == 0 || len (result .Reservations [0 ].Instances ) == 0 {
You can’t perform that action at this time.
0 commit comments