You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(dynamodb): throw ValidationErrors instead of untyped Errors (#33871)
### Issue # (if applicable)
Relates to #32569
### Reason for this change
untyped Errors are not recommended
### Description of changes
ValidationErrors everywhere
### Describe any new or updated permissions being added
None
### Description of how you validated changes
Existing tests. Exemptions granted as this is a refactor of existing code.
### 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*
thrownewError(`Cannot configure 'readCapacity' for replica global secondary index, ${indexName}, because billing mode is ${BillingMode.PAY_PER_REQUEST}`);
977
+
thrownewValidationError(`Cannot configure 'readCapacity' for replica global secondary index, ${indexName}, because billing mode is ${BillingMode.PAY_PER_REQUEST}`,this);
978
978
}
979
979
}
980
980
}
981
981
982
982
privatevalidateReplica(props: ReplicaTableProps){
983
983
conststackRegion=this.stack.region;
984
984
if(Token.isUnresolved(stackRegion)){
985
-
thrownewError('Replica tables are not supported in a region agnostic stack');
985
+
thrownewValidationError('Replica tables are not supported in a region agnostic stack',this);
986
986
}
987
987
988
988
if(Token.isUnresolved(props.region)){
989
-
thrownewError('Replica table region must not be a token');
989
+
thrownewValidationError('Replica table region must not be a token',this);
990
990
}
991
991
992
992
if(props.region===this.stack.region){
993
-
thrownewError(`You cannot add a replica table in the same region as the primary table - the primary table region is ${this.region}`);
993
+
thrownewValidationError(`You cannot add a replica table in the same region as the primary table - the primary table region is ${this.region}`,this);
994
994
}
995
995
996
996
if(this.replicaTables.has(props.region)){
997
-
thrownewError(`Duplicate replica table region, ${props.region}, is not allowed`);
997
+
thrownewValidationError(`Duplicate replica table region, ${props.region}, is not allowed`,this);
thrownewError(`You cannot configure 'readCapacity' or 'writeCapacity' on a global secondary index when the billing mode is ${BillingMode.PAY_PER_REQUEST}`);
1013
+
thrownewValidationError(`You cannot configure 'readCapacity' or 'writeCapacity' on a global secondary index when the billing mode is ${BillingMode.PAY_PER_REQUEST}`,this);
0 commit comments