diff --git a/packages/aws-cdk-lib/aws-cloudwatch/lib/graph.ts b/packages/aws-cdk-lib/aws-cloudwatch/lib/graph.ts index 8ad479f5056ad..e5172a57b5c4a 100644 --- a/packages/aws-cdk-lib/aws-cloudwatch/lib/graph.ts +++ b/packages/aws-cdk-lib/aws-cloudwatch/lib/graph.ts @@ -243,7 +243,7 @@ export class GaugeWidget extends ConcreteWidget { this.copyMetricWarnings(...this.metrics); if (props.end !== undefined && props.start === undefined) { - throw new Error('You must also specify a start if you specify an end'); + throw new Error('If you specify a value for end, you must also specify a value for start.'); } } @@ -436,7 +436,7 @@ export class GraphWidget extends ConcreteWidget { this.copyMetricWarnings(...this.leftMetrics, ...this.rightMetrics); if (props.end !== undefined && props.start === undefined) { - throw new Error('You must also specify a start if you specify an end'); + throw new Error('If you specify a value for end, you must also specify a value for start.'); } } @@ -574,7 +574,7 @@ export class SingleValueWidget extends ConcreteWidget { } if (props.end !== undefined && props.start === undefined) { - throw new Error('You must also specify a start if you specify an end'); + throw new Error('If you specify a value for end, you must also specify a value for start.'); } } diff --git a/packages/aws-cdk-lib/aws-cloudwatch/test/graphs.test.ts b/packages/aws-cdk-lib/aws-cloudwatch/test/graphs.test.ts index 7fb2ce8bcd69c..afe053d83612c 100644 --- a/packages/aws-cdk-lib/aws-cloudwatch/test/graphs.test.ts +++ b/packages/aws-cdk-lib/aws-cloudwatch/test/graphs.test.ts @@ -953,7 +953,7 @@ describe('Graphs', () => { view: GraphWidgetView.PIE, end: '2018-12-17T06:00:00.000Z', }); - }).toThrow(/You must also specify a start if you specify an end/); + }).toThrow(/If you specify a value for end, you must also specify a value for start./); }); test('cannot specify an end without a start in SingleValueWidget', () => { @@ -966,7 +966,7 @@ describe('Graphs', () => { metrics: [new Metric({ namespace: 'CDK', metricName: 'Test' })], end: '2018-12-17T06:00:00.000Z', }); - }).toThrow(/You must also specify a start if you specify an end/); + }).toThrow(/If you specify a value for end, you must also specify a value for start./); }); test('cannot specify an end without a start in GaugeWidget', () => { @@ -979,6 +979,6 @@ describe('Graphs', () => { metrics: [new Metric({ namespace: 'CDK', metricName: 'Test' })], end: '2018-12-17T06:00:00.000Z', }); - }).toThrow(/You must also specify a start if you specify an end/); + }).toThrow(/If you specify a value for end, you must also specify a value for start./); }); });