Skip to content

Commit

Permalink
Report AspectCreationException to the user
Browse files Browse the repository at this point in the history
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
  • Loading branch information
fmeum authored and copybara-github committed Jan 10, 2023
1 parent 4970ea6 commit db3c013
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -465,6 +465,10 @@ public SkyValue compute(SkyKey key, Environment env)
}
throw new ReportedException(e);
} catch (AspectCreationException e) {
if (!e.getMessage().isEmpty()) {
// Report the error to the user.
env.getListener().handle(Event.error(null, e.getMessage()));
}
throw new ReportedException(
new ConfiguredValueCreationException(
targetAndConfiguration, e.getMessage(), e.getCauses(), e.getDetailedExitCode()));
Expand Down

0 comments on commit db3c013

Please sign in to comment.