You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(backup): throw ValidationError instead of untyped Errors (#33387)
### Issue
Relates to #32569
### Description of changes
`ValidationErrors` everywhere
### Describe any new or updated permissions being added
n/a
### Description of how you validated changes
Existing tests. Exemptions granted as this is a refactor of existing code.
### Checklist
- [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md)
----
*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
thrownewError(`'deleteAfter' must be between 1 and 35 days if 'enableContinuousBackup' is enabled, but got ${props.deleteAfter.toHumanString()}`);
224
+
thrownewUnscopedValidationError(`'deleteAfter' must be between 1 and 35 days if 'enableContinuousBackup' is enabled, but got ${props.deleteAfter.toHumanString()}`);
thrownewError(`AWS Backup enforces a 72-hour cooling-off period before Vault Lock takes effect and becomes immutable, got ${config.changeableFor.toHours()} hours`);
345
+
thrownewValidationError(`AWS Backup enforces a 72-hour cooling-off period before Vault Lock takes effect and becomes immutable, got ${config.changeableFor.toHours()} hours`,scope);
346
346
}
347
347
348
348
if(config.maxRetention){
349
349
if(config.maxRetention.toDays()>36500){
350
-
thrownewError(`The longest maximum retention period you can specify is 36500 days, got ${config.maxRetention.toDays()} days`);
350
+
thrownewValidationError(`The longest maximum retention period you can specify is 36500 days, got ${config.maxRetention.toDays()} days`,scope);
thrownewError(`The maximum retention period (${config.maxRetention.toDays()} days) must be greater than the minimum retention period (${config.minRetention.toDays()} days)`);
353
+
thrownewValidationError(`The maximum retention period (${config.maxRetention.toDays()} days) must be greater than the minimum retention period (${config.minRetention.toDays()} days)`,scope);
354
354
}
355
355
}
356
356
357
357
if(config.minRetention.toHours()<24){
358
-
thrownewError(`The shortest minimum retention period you can specify is 1 day, got ${config.minRetention.toHours()} hours`);
358
+
thrownewValidationError(`The shortest minimum retention period you can specify is 1 day, got ${config.minRetention.toHours()} hours`,scope);
0 commit comments