-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Typed Errors for cli/toolkit #32347
Copy link
Copy link
Closed
Labels
Description
- Introduce a new typed error into the CLI:
ToolkitError, see errors.ts fromaws-cdk-libfor an example howeverToolkitErrorwill not take a scope as input. - Implement a static
isToolkitErrormessage on theToolkitErrorclass - Implement an
AuthenticationErrorthat extendsToolkitErrorand sets type'authentication' - Every error we throw in the CLI should throw
ToolkitErrororAuthenticationErrordepending on the situation. - Enforce this usage by configuring the
no-throw-default-errorrule from cdklabs/eslint-rules for theaws-cdkpackage (do this first)- Top tip: extend the linter fix suggestions here to add a new suggestion for
ToolkitError/AuthenticationError. If you do that and enable the linter rule, changing every error will be almost automatic and super easy. I highly recommend you do this.
- Top tip: extend the linter fix suggestions here to add a new suggestion for
Errors that are re-thrown unchanged, should stay like that. Existing typed errors (like CfnEvaluationException) should be converted into our new error system.
Create all new files inside a new directory lib/toolkit. All files and classes should be private.
Reactions are currently unavailable