@@ -11,7 +11,7 @@ import { dispatchMetric, metricPeriod } from './private/metric-util';
1111import { dropUndefined } from './private/object' ;
1212import { MetricSet } from './private/rendering' ;
1313import { normalizeStatistic , parseStatistic } from './private/statistic' ;
14- import { ArnFormat , Lazy , Stack , Token , Annotations , ValidationError , AssumptionError , UnscopedValidationError } from '../../core' ;
14+ import { ArnFormat , Lazy , Stack , Token , Annotations , ValidationError , AssumptionError } from '../../core' ;
1515import { addConstructMetadata , MethodMetadata } from '../../core/lib/metadata-resource' ;
1616import { propertyInjectable } from '../../core/lib/prop-injectable' ;
1717
@@ -475,7 +475,7 @@ export class Alarm extends AlarmBase {
475475 } ;
476476 } ,
477477
478- withMathExpression ( ) {
478+ withMathExpression : ( ) => {
479479 // Expand the math expression metric into a set
480480 const mset = new MetricSet < boolean > ( ) ;
481481 mset . addTopLevel ( true , metric ) ;
@@ -534,8 +534,8 @@ export class Alarm extends AlarmBase {
534534 returnData,
535535 } ;
536536 } ,
537- withSearchExpression ( _searchExpr , _conf ) {
538- throw new UnscopedValidationError ( 'Search expressions are not supported in CloudWatch Alarms. Use search expressions only in dashboard graphs.' ) ;
537+ withSearchExpression : ( _searchExpr , _conf ) => {
538+ throw new ValidationError ( 'Search expressions are not supported in CloudWatch Alarms. Use search expressions only in dashboard graphs.' , this ) ;
539539 } ,
540540 } ) ;
541541 } ) ,
@@ -547,8 +547,8 @@ export class Alarm extends AlarmBase {
547547
548548 return { props, primaryId } ;
549549 } ,
550- withSearchExpression ( ) {
551- throw new UnscopedValidationError ( 'Search expressions are not supported in CloudWatch Alarms. Use search expressions only in dashboard graphs.' ) ;
550+ withSearchExpression : ( ) => {
551+ throw new ValidationError ( 'Search expressions are not supported in CloudWatch Alarms. Use search expressions only in dashboard graphs.' , this ) ;
552552 } ,
553553 } ) ;
554554 }
0 commit comments