Skip to content

Commit b76ec12

Browse files
mazyu36Dahlberg Victor
authored andcommitted
chore(dynamodb): remove single quotes from throw statement in the parseEncryption method (#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*
1 parent a11831a commit b76ec12

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

packages/aws-cdk-lib/aws-dynamodb/lib/table.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1630,7 +1630,7 @@ export class Table extends TableBase {
16301630
}
16311631

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

16361636
if (encryptionType === TableEncryption.CUSTOMER_MANAGED && props.replicationRegions) {

packages/aws-cdk-lib/aws-dynamodb/test/dynamodb.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,7 @@ test('fails if encryption key is used with AWS managed CMK', () => {
466466
partitionKey: TABLE_PARTITION_KEY,
467467
encryption: TableEncryption.AWS_MANAGED,
468468
encryptionKey,
469-
})).toThrow('`encryptionKey cannot be specified unless encryption is set to TableEncryption.CUSTOMER_MANAGED (it was set to ${encryptionType})`');
469+
})).toThrow(`encryptionKey cannot be specified unless encryption is set to TableEncryption.CUSTOMER_MANAGED (it was set to ${TableEncryption.AWS_MANAGED})`);
470470
});
471471

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

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

0 commit comments

Comments
 (0)