Skip to content

Commit db3c013

Browse files
fmeumcopybara-github
authored andcommitted
Report AspectCreationException to the user
Since ec4be00, `AspectCreationException`s are no longer reported to the user, resulting in error messages such as: ``` ERROR: Analysis of target '//pkg:foo' failed; build aborted: ``` With this commit, the error looks like this instead: ``` ERROR: Evaluation of aspect //aspects:aspects.bzl%my_aspect on //pkg:foo failed: <causes...> ``` Context: bazelbuild/bazel-central-registry#327 Closes bazelbuild#17071. PiperOrigin-RevId: 500883551 Change-Id: Iaf3b1dff8cb0915dd1ddc51d1d5e6578ff44029b
1 parent 4970ea6 commit db3c013

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/main/java/com/google/devtools/build/lib/skyframe/ConfiguredTargetFunction.java

+4
Original file line numberDiff line numberDiff line change
@@ -465,6 +465,10 @@ public SkyValue compute(SkyKey key, Environment env)
465465
}
466466
throw new ReportedException(e);
467467
} catch (AspectCreationException e) {
468+
if (!e.getMessage().isEmpty()) {
469+
// Report the error to the user.
470+
env.getListener().handle(Event.error(null, e.getMessage()));
471+
}
468472
throw new ReportedException(
469473
new ConfiguredValueCreationException(
470474
targetAndConfiguration, e.getMessage(), e.getCauses(), e.getDetailedExitCode()));

0 commit comments

Comments
 (0)