Skip to content

Commit e72d40c

Browse files
author
Abid Hasan
committed
add scope validation error
1 parent ec7e001 commit e72d40c

File tree

1 file changed

+6
-6
lines changed
  • packages/aws-cdk-lib/aws-cloudwatch/lib

1 file changed

+6
-6
lines changed

packages/aws-cdk-lib/aws-cloudwatch/lib/alarm.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { dispatchMetric, metricPeriod } from './private/metric-util';
1111
import { dropUndefined } from './private/object';
1212
import { MetricSet } from './private/rendering';
1313
import { 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';
1515
import { addConstructMetadata, MethodMetadata } from '../../core/lib/metadata-resource';
1616
import { 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

Comments
 (0)