Skip to content

Commit 431fe10

Browse files
fix: return proper error for invalid dynamo query instead of panic
Signed-off-by: Palagiri Subba Reddy <subbareddy123sub@gmail.com>
1 parent b10ccb3 commit 431fe10

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

lore-aws/src/dynamodb.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -566,6 +566,10 @@ impl DynamoDbImpl {
566566
where
567567
T: DynamoDbQuery + 'static,
568568
{
569+
if matches!(query.select(), Some(Select::Count)) && query.limit().is_some() {
570+
return Err(aws_sdk_dynamodb::error::SdkError::construction_failure("Combining Select::Count and a limit is disallowed for paginated queries").into());
571+
}
572+
569573
if matches!(query.select(), Some(Select::Count)) && query.limit().is_some() {
570574
panic!("Combining Select::Count and a limit is disallowed for paginated queries to avoid fetching count one row at a time.");
571575
}

0 commit comments

Comments
 (0)