Skip to content

Commit

Permalink
Return storage error if DynamoDB returns an empty response
Browse files Browse the repository at this point in the history
  • Loading branch information
ErikBZ committed May 30, 2024
1 parent 1a6c803 commit aa3232b
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions storage/dynamodb/dynamodb.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,12 @@ func (c *conn) getItem(content_type string, id string) (*dynamodb.GetItemOutput,
},
TableName: aws.String(c.table)},
)

// Check for storage.ErrorNotFound
if err != nil {

Check failure on line 113 in storage/dynamodb/dynamodb.go

View workflow job for this annotation

GitHub Actions / Lint

ifElseChain: rewrite if-else to switch statement (gocritic)
return resp, fmt.Errorf("getting item from dynamodb: %v", err)
} else if len(resp.Item) < 1 {
return resp, storage.ErrNotFound
} else {
return resp, nil
}
Expand Down Expand Up @@ -351,11 +355,6 @@ func (c *conn) GetKeys() (storage.Keys, error) {
}

storageKey := toStorageKey(keyResp)

if err != nil {
return storage.Keys{}, err
}

return storageKey, err
}

Expand Down

0 comments on commit aa3232b

Please sign in to comment.