Skip to content

Improve SmithyBuilder error messages#1100

Merged
mtdowling merged 2 commits intomainfrom
improve-builder-error-messages
Feb 19, 2022
Merged

Improve SmithyBuilder error messages#1100
mtdowling merged 2 commits intomainfrom
improve-builder-error-messages

Conversation

@mtdowling
Copy link
Copy Markdown
Member

When a SmithyBuilder implementation is missing a required property, the
name of the class that was missing the property will be included in the
error message. This is derived by looking at the stacktrace on error, so
it's an inference. But even an inference of the builder class is better
than having no idea which builder encountered an error when the stack
trace of the IllegalStateException is elided for whatever reason.

Issue #, if available:

Description of changes:

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

When a SmithyBuilder implementation is missing a required property, the
name of the class that was missing the property will be included in the
error message. This is derived by looking at the stacktrace on error, so
it's an inference. But even an inference of the builder class is better
than having no idea which builder encountered an error when the stack
trace of the IllegalStateException is elided for whatever reason.
@mtdowling mtdowling requested a review from a team as a code owner February 18, 2022 21:11
There is a specific code path in SmithyBuild that results in impossible
to debug error messages. It's caused when importing a model fails and
results in a Model not being created at all (for example, this can
happen if something really bad happens like a trait throwing a
SourceException when calling toNode). In this case, SmithyBuild tries to
create a ProjectionResult with no Model, but ProjectionResult requires a
model. This is now detected, an empty model is provided, and the build
will fail in a way that shows a proper error message.
@mtdowling mtdowling force-pushed the improve-builder-error-messages branch from f304a97 to 7defc2f Compare February 19, 2022 01:26
@mtdowling mtdowling merged commit 0c6fc20 into main Feb 19, 2022
@mtdowling mtdowling deleted the improve-builder-error-messages branch April 8, 2022 05:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants