Skip to content

Commit

Permalink
dynamodb: check err type in tableIsAlive method
Browse files Browse the repository at this point in the history
  • Loading branch information
adamstruck committed Jun 1, 2018
1 parent b48fe21 commit 003abee
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions database/dynamodb/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -199,10 +199,16 @@ func (db *DynamoDB) tableIsAlive(ctx context.Context, name string) error {
r, err := db.client.DescribeTable(&dynamodb.DescribeTableInput{
TableName: aws.String(name),
})
if err == nil {
if *r.Table.TableStatus == "ACTIVE" {
return nil
if err != nil {
if aerr, ok := err.(awserr.Error); ok {
if aerr.Code() == dynamodb.ErrCodeResourceNotFoundException {
continue
}
}
return err
}
if *r.Table.TableStatus == "ACTIVE" {
return nil
}
}
}
Expand Down

0 comments on commit 003abee

Please sign in to comment.