Skip to content
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

Merged
merged 3 commits into from
Mar 2, 2021

Conversation

rix0rrr
Copy link
Contributor

@rix0rrr rix0rrr commented Mar 2, 2021


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

@rix0rrr rix0rrr requested a review from a team March 2, 2021 13:30
@rix0rrr rix0rrr self-assigned this Mar 2, 2021
@gitpod-io
Copy link

gitpod-io bot commented Mar 2, 2021

@mergify mergify bot added the contribution/core This is a PR that came from AWS. label Mar 2, 2021

* Eagerly throw an exception (fails synthesis)
* Attach a (lazy) validator to a construct (fails synthesis)
* Attach errors to a construct (fails deployment)
Copy link
Contributor

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

Copy link
Contributor Author

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...

Copy link
Contributor

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.

DESIGN_GUIDELINES.md Outdated Show resolved Hide resolved
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.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Example?

DESIGN_GUIDELINES.md Outdated Show resolved Hide resolved
#### Attached Errors/Warnings
Always prefer early input validation over post-validation, as the necessity
of these should be rare.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Example

@eladb eladb added the pr/do-not-merge This PR should not be merged at this time. label Mar 2, 2021
@rix0rrr rix0rrr removed the pr/do-not-merge This PR should not be merged at this time. label Mar 2, 2021
@mergify
Copy link
Contributor

mergify bot commented Mar 2, 2021

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).

@mergify
Copy link
Contributor

mergify bot commented Mar 2, 2021

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).

@mergify mergify bot merged commit 7b96688 into master Mar 2, 2021
@mergify mergify bot deleted the huijbers/guidelines-error-messages branch March 2, 2021 15:59
@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildProject89A8053A-LhjRyN9kxr8o
  • Commit ID: 51d1531
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

cornerwings pushed a commit to cornerwings/aws-cdk that referenced this pull request Mar 8, 2021
----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contribution/core This is a PR that came from AWS.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants