From aa3232b0871795ccfa861ca7eddbe4f1605cc528 Mon Sep 17 00:00:00 2001 From: ErikBZ Date: Thu, 30 May 2024 15:23:20 -0400 Subject: [PATCH] Return storage error if DynamoDB returns an empty response --- storage/dynamodb/dynamodb.go | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/storage/dynamodb/dynamodb.go b/storage/dynamodb/dynamodb.go index b2ebf93cf2..7973311d30 100644 --- a/storage/dynamodb/dynamodb.go +++ b/storage/dynamodb/dynamodb.go @@ -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 { return resp, fmt.Errorf("getting item from dynamodb: %v", err) + } else if len(resp.Item) < 1 { + return resp, storage.ErrNotFound } else { return resp, nil } @@ -351,11 +355,6 @@ func (c *conn) GetKeys() (storage.Keys, error) { } storageKey := toStorageKey(keyResp) - - if err != nil { - return storage.Keys{}, err - } - return storageKey, err }