Skip to content

Commit 89340b0

Browse files
kaizenccyashkh-amzn
authored andcommitted
feat(chatbot): throw ValidationError instead of untyped Error (aws#33439)
### Issue Relates to aws#32569 ### Description of changes `ValidationError` in one location ### 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 ad11d0e commit 89340b0

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

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

+1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ const enableNoThrowDefaultErrorIn = [
3232
'aws-autoscaling-common',
3333
'aws-backup',
3434
'aws-batch',
35+
'aws-chatbot',
3536
'aws-cognito',
3637
'aws-cloudfront',
3738
'aws-cloudfront-origins',

packages/aws-cdk-lib/aws-chatbot/lib/slack-channel-configuration.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ export class SlackChannelConfiguration extends SlackChannelConfigurationBase {
219219
const resourceName = cdk.Arn.extractResourceName(slackChannelConfigurationArn, 'chat-configuration');
220220

221221
if (!cdk.Token.isUnresolved(slackChannelConfigurationArn) && !re.test(resourceName)) {
222-
throw new Error('The ARN of a Slack integration must be in the form: arn:<partition>:chatbot:<region>:<account>:chat-configuration/slack-channel/<slackChannelName>');
222+
throw new cdk.ValidationError('The ARN of a Slack integration must be in the form: arn:<partition>:chatbot:<region>:<account>:chat-configuration/slack-channel/<slackChannelName>', scope);
223223
}
224224

225225
class Import extends SlackChannelConfigurationBase {

0 commit comments

Comments
 (0)