Improve error reporting for missing index

This commit is contained in:
Ilya Shmygol 2019-12-12 10:49:07 +01:00
commit 704a12146b
2 changed files with 9 additions and 5 deletions

View file

@ -2655,14 +2655,15 @@ def test_query_by_non_exists_index():
],
)
with assert_raises(ValueError) as ex:
with assert_raises(ClientError) as ex:
dynamodb.query(
TableName="test",
IndexName="non_exists_index",
KeyConditionExpression="CarModel=M",
)
str(ex.exception).should.equal(
ex.exception.response["Error"]["Code"].should.equal("ResourceNotFoundException")
ex.exception.response["Error"]["Message"].should.equal(
"Invalid index: non_exists_index for table: test. Available indexes are: test_gsi"
)