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(ecr): throw ValidationError instead of untyped Errors (#33750)
### 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*
@@ -630,7 +632,7 @@ export class Repository extends RepositoryBase {
630
632
// repository names can include "/" (e.g. foo/bar/myrepo) and it is impossible to
631
633
// parse the name from an ARN using CloudFormation's split/select.
632
634
if(Token.isUnresolved(repositoryArn)){
633
-
thrownewError('"repositoryArn" is a late-bound value, and therefore "repositoryName" is required. Use `fromRepositoryAttributes` instead');
635
+
thrownewUnscopedValidationError('"repositoryArn" is a late-bound value, and therefore "repositoryName" is required. Use `fromRepositoryAttributes` instead');
634
636
}
635
637
636
638
validateRepositoryArn();
@@ -655,7 +657,7 @@ export class Repository extends RepositoryBase {
thrownewError(`Repository arn should be in the format 'arn:<PARTITION>:ecr:<REGION>:<ACCOUNT>:repository/<NAME>', got ${repositoryArn}.`);
660
+
thrownewUnscopedValidationError(`Repository arn should be in the format 'arn:<PARTITION>:ecr:<REGION>:<ACCOUNT>:repository/<NAME>', got ${repositoryArn}.`);
659
661
}
660
662
}
661
663
}
@@ -707,7 +709,7 @@ export class Repository extends RepositoryBase {
707
709
}
708
710
709
711
if(errors.length>0){
710
-
thrownewError(`Invalid ECR repository name (value: ${repositoryName})${EOL}${errors.join(EOL)}`);
712
+
thrownewUnscopedValidationError(`Invalid ECR repository name (value: ${repositoryName})${EOL}${errors.join(EOL)}`);
711
713
}
712
714
}
713
715
@@ -754,10 +756,10 @@ export class Repository extends RepositoryBase {
thrownewError(`A tag pattern cannot contain more than four wildcard characters (*), pattern: ${pattern}, counts: ${splitPatternLength-1}`);
818
+
thrownewValidationError(`A tag pattern cannot contain more than four wildcard characters (*), pattern: ${pattern}, counts: ${splitPatternLength-1}`,this);
0 commit comments