Skip to content

Commit

Permalink
use ValidationError
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Jan 24, 2025
1 parent 74306bd commit 11291e7
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/aws-cdk-lib/aws-synthetics/lib/canary.ts
Original file line number Diff line number Diff line change
Expand Up @@ -354,16 +354,16 @@ export class Canary extends cdk.Resource implements ec2.IConnectable {
validateName(props.canaryName);
}

if (props.cleanup === Cleanup.LAMBDA && props.provisionedResourceCleanup) {
throw new Error('Cannot specify `provisionedResourceCleanup` when `cleanup` is set to `Cleanup.LAMBDA`. Use only `provisionedResourceCleanup`.');
}

super(scope, id, {
physicalName: props.canaryName || cdk.Lazy.string({
produce: () => this.generateUniqueName(),
}),
});

if (props.cleanup === Cleanup.LAMBDA && props.provisionedResourceCleanup) {
throw new ValidationError('Cannot specify `provisionedResourceCleanup` when `cleanup` is set to `Cleanup.LAMBDA`. Use only `provisionedResourceCleanup`.', this);
}

this.artifactsBucket = props.artifactsBucketLocation?.bucket ?? new s3.Bucket(this, 'ArtifactsBucket', {
encryption: s3.BucketEncryption.KMS_MANAGED,
enforceSSL: true,
Expand Down

0 comments on commit 11291e7

Please sign in to comment.