@@ -7,7 +7,7 @@ import * as lambda from '../../aws-lambda';
7
7
import * as logs from '../../aws-logs' ;
8
8
import * as s3 from '../../aws-s3' ;
9
9
import * as sns from '../../aws-sns' ;
10
- import { Resource , Stack } from '../../core' ;
10
+ import { Resource , Stack , ValidationError } from '../../core' ;
11
11
import { addConstructMetadata , MethodMetadata } from '../../core/lib/metadata-resource' ;
12
12
13
13
/**
@@ -322,7 +322,7 @@ export class Trail extends Resource {
322
322
this . node . addValidation ( { validate : ( ) => this . validateEventSelectors ( ) } ) ;
323
323
324
324
if ( props . kmsKey && props . encryptionKey ) {
325
- throw new Error ( 'Both kmsKey and encryptionKey must not be specified. Use only encryptionKey' ) ;
325
+ throw new ValidationError ( 'Both kmsKey and encryptionKey must not be specified. Use only encryptionKey' , this ) ;
326
326
}
327
327
328
328
if ( props . insightTypes ) {
@@ -384,11 +384,11 @@ export class Trail extends Resource {
384
384
@MethodMetadata ( )
385
385
public addEventSelector ( dataResourceType : DataResourceType , dataResourceValues : string [ ] , options : AddEventSelectorOptions = { } ) {
386
386
if ( dataResourceValues . length > 250 ) {
387
- throw new Error ( 'A maximum of 250 data elements can be in one event selector' ) ;
387
+ throw new ValidationError ( 'A maximum of 250 data elements can be in one event selector' , this ) ;
388
388
}
389
389
390
390
if ( this . eventSelectors . length > 5 ) {
391
- throw new Error ( 'A maximum of 5 event selectors are supported per trail.' ) ;
391
+ throw new ValidationError ( 'A maximum of 5 event selectors are supported per trail.' , this ) ;
392
392
}
393
393
394
394
let includeAllManagementEvents ;
0 commit comments