Skip to content

Commit

Permalink
chore(dynamodb): remove single quotes from throw statement in the par…
Browse files Browse the repository at this point in the history
…seEncryption method (aws#30417)

Removed the single quotes around the error message string to allow proper interpolation of the ${encryptionType} variable. 

### Checklist
- [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md)

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
  • Loading branch information
mazyu36 committed Jun 22, 2024
1 parent ea66260 commit 76181c4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/aws-cdk-lib/aws-dynamodb/lib/table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1630,7 +1630,7 @@ export class Table extends TableBase {
}

if (encryptionType !== TableEncryption.CUSTOMER_MANAGED && props.encryptionKey) {
throw new Error('`encryptionKey cannot be specified unless encryption is set to TableEncryption.CUSTOMER_MANAGED (it was set to ${encryptionType})`');
throw new Error(`encryptionKey cannot be specified unless encryption is set to TableEncryption.CUSTOMER_MANAGED (it was set to ${encryptionType})`);
}

if (encryptionType === TableEncryption.CUSTOMER_MANAGED && props.replicationRegions) {
Expand Down
4 changes: 2 additions & 2 deletions packages/aws-cdk-lib/aws-dynamodb/test/dynamodb.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,7 @@ test('fails if encryption key is used with AWS managed CMK', () => {
partitionKey: TABLE_PARTITION_KEY,
encryption: TableEncryption.AWS_MANAGED,
encryptionKey,
})).toThrow('`encryptionKey cannot be specified unless encryption is set to TableEncryption.CUSTOMER_MANAGED (it was set to ${encryptionType})`');
})).toThrow(`encryptionKey cannot be specified unless encryption is set to TableEncryption.CUSTOMER_MANAGED (it was set to ${TableEncryption.AWS_MANAGED})`);
});

test('fails if encryption key is used with default encryption', () => {
Expand All @@ -479,7 +479,7 @@ test('fails if encryption key is used with default encryption', () => {
partitionKey: TABLE_PARTITION_KEY,
encryption: TableEncryption.DEFAULT,
encryptionKey,
})).toThrow('`encryptionKey cannot be specified unless encryption is set to TableEncryption.CUSTOMER_MANAGED (it was set to ${encryptionType})`');
})).toThrow(`encryptionKey cannot be specified unless encryption is set to TableEncryption.CUSTOMER_MANAGED (it was set to ${TableEncryption.DEFAULT})`);
});

testDeprecated('fails if encryption key is used with serverSideEncryption', () => {
Expand Down

0 comments on commit 76181c4

Please sign in to comment.