Skip to content

Commit 19cf902

Browse files
authored
feat(assets): throw ValidationError instead of untyped Errors (#33383)
### 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*
1 parent c400e0e commit 19cf902

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

packages/aws-cdk-lib/.eslintrc.js

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ baseConfig.rules['import/no-extraneous-dependencies'] = [
1616

1717
// no-throw-default-error
1818
const enableNoThrowDefaultErrorIn = [
19+
'assets',
1920
'aws-amplify',
2021
'aws-amplifyuibuilder',
2122
'aws-apigateway',

packages/aws-cdk-lib/assets/lib/compat.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { FollowMode } from './fs/follow-mode';
2-
import { SymlinkFollowMode } from '../../core';
2+
import { SymlinkFollowMode, UnscopedValidationError } from '../../core';
33

44
export function toSymlinkFollow(follow?: FollowMode): SymlinkFollowMode | undefined {
55
if (!follow) {
@@ -12,6 +12,6 @@ export function toSymlinkFollow(follow?: FollowMode): SymlinkFollowMode | undefi
1212
case FollowMode.BLOCK_EXTERNAL: return SymlinkFollowMode.BLOCK_EXTERNAL;
1313
case FollowMode.EXTERNAL: return SymlinkFollowMode.EXTERNAL;
1414
default:
15-
throw new Error(`unknown follow mode: ${follow}`);
15+
throw new UnscopedValidationError(`unknown follow mode: ${follow}`);
1616
}
1717
}

0 commit comments

Comments
 (0)