Skip to content

Commit

Permalink
feat(assets): throw ValidationError instead of untyped Errors (#33383)
Browse files Browse the repository at this point in the history
### 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*
  • Loading branch information
mrgrain authored Feb 11, 2025
1 parent c400e0e commit 19cf902
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions packages/aws-cdk-lib/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ baseConfig.rules['import/no-extraneous-dependencies'] = [

// no-throw-default-error
const enableNoThrowDefaultErrorIn = [
'assets',
'aws-amplify',
'aws-amplifyuibuilder',
'aws-apigateway',
Expand Down
4 changes: 2 additions & 2 deletions packages/aws-cdk-lib/assets/lib/compat.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { FollowMode } from './fs/follow-mode';
import { SymlinkFollowMode } from '../../core';
import { SymlinkFollowMode, UnscopedValidationError } from '../../core';

export function toSymlinkFollow(follow?: FollowMode): SymlinkFollowMode | undefined {
if (!follow) {
Expand All @@ -12,6 +12,6 @@ export function toSymlinkFollow(follow?: FollowMode): SymlinkFollowMode | undefi
case FollowMode.BLOCK_EXTERNAL: return SymlinkFollowMode.BLOCK_EXTERNAL;
case FollowMode.EXTERNAL: return SymlinkFollowMode.EXTERNAL;
default:
throw new Error(`unknown follow mode: ${follow}`);
throw new UnscopedValidationError(`unknown follow mode: ${follow}`);
}
}

0 comments on commit 19cf902

Please sign in to comment.