Skip to content

Commit

Permalink
Merge pull request #8 from ErikBZ/bugfix/INT-6127-return-storage-error
Browse files Browse the repository at this point in the history
Return storage error if DynamoDB returns an empty response
  • Loading branch information
favipcj authored May 30, 2024
2 parents 1a6c803 + aa3232b commit 981df85
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 981df85

Please sign in to comment.