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

Revert "Revert "Defer projection failure until after plugins run (#1416)" (#1429)" #1430

Closed

Conversation

milesziemer
Copy link
Contributor

This reverts commit 18676ec.

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

@milesziemer milesziemer requested a review from a team as a code owner September 29, 2022 14:26
projectedModel, resolvedModel, modelResult, resultBuilder);
} catch (Throwable e) {
LOGGER.severe(String.format("Plugin `%s` failed: %s", entry.getKey(), e));
Copy link
Member

Choose a reason for hiding this comment

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

I think this would output the first error twice since we're still throwing it and logging it now. Would be good to see how this ends up looking in practice. If it's not good, then... don't log the first error?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yea, it logs every plugin failure, but only throws the first one. This comment on the original PR explains why I made that choice, but in short it is to show all plugin failures instead of just the first one. Here's a comparison of what it looks like:
Current state

INFO: Applying `broken` plugin to `source` projection

1 Smithy build projections failed.

(source): java.lang.RuntimeException: broken

software.amazon.smithy.build.SmithyBuildException: 1 Smithy build projections failed.

(source): java.lang.RuntimeException: broken

Logging plugin errors (what this PR does)

INFO: Applying `broken` plugin to `source` projection
SEVERE: Plugin `broken` failed: java.lang.RuntimeException: broken
INFO: Applying `build-info` plugin to `source` projection
INFO: Applying `model` plugin to `source` projection
INFO: Applying `sources` plugin to `source` projection
INFO: Writing empty `source` manifest because no Smithy sources found
INFO: Applying `test1Serial` plugin to `source` projection

1 Smithy build projections failed.

(source): java.lang.RuntimeException: broken

software.amazon.smithy.build.SmithyBuildException: 1 Smithy build projections failed.

(source): java.lang.RuntimeException: broken

Not logging the plugin errors

INFO: Applying `broken` plugin to `source` projection
INFO: Applying `build-info` plugin to `source` projection
INFO: Applying `model` plugin to `source` projection
INFO: Applying `sources` plugin to `source` projection
INFO: Writing empty `source` manifest because no Smithy sources found
INFO: Applying `test1Serial` plugin to `source` projection

1 Smithy build projections failed.

(source): java.lang.RuntimeException: broken

software.amazon.smithy.build.SmithyBuildException: 1 Smithy build projections failed.

(source): java.lang.RuntimeException: broken

Like I mentioned in the comment on the original commit, I think it would be better if we aggregated all plugin failures into one exception.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think @mtdowling is asking to not log this if the firstPluginError is null, since that one will end up being thrown.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've opened #1762 with those changes. Looking at the output now, I think its nicer to not log the first error since it doesn't do that right now.

@milesziemer
Copy link
Contributor Author

Closing this in favor of #1762 to avoid merge conflicts.

@milesziemer milesziemer closed this May 4, 2023
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.

3 participants