-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore(guidelines): update the section on error messages #13345
Conversation
DESIGN_GUIDELINES.md
Outdated
|
||
* Eagerly throw an exception (fails synthesis) | ||
* Attach a (lazy) validator to a construct (fails synthesis) | ||
* Attach errors to a construct (fails deployment) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Error won't fail deployment, they will fail synthesis but only after the whole app has been initialized
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Which error are you talking about?
And if synthesis fails, deployment cannot even proceed so I though it was pointless to put it here. But granted, what's written here might not be clear enough if you're not too intimately familiar with the lifecycle. I was trying to be terse but I may be erroring...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am talking about errors that are attached to constructs. Those errors will fail the CLI synth (and deploy of course) but will not fail the app initialization and synthesis.
Validate input as early as it is passed into your code (ctor, methods, | ||
etc) and bail out by throwing an **Error**. No need to create subclasses of | ||
Error since all errors in the CDK are unrecoverable. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Example?
#### Attached Errors/Warnings | ||
Always prefer early input validation over post-validation, as the necessity | ||
of these should be rare. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Example
Thank you for contributing! Your pull request will be updated from master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
Thank you for contributing! Your pull request will be updated from master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license