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

PiperOrigin-RevId: 500883551
Change-Id: Iaf3b1dff8cb0915dd1ddc51d1d5e6578ff44029b
  • Loading branch information
fmeum authored and hvadehra committed Feb 14, 2023
1 parent 51a8b3b commit 15ae23e
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 15ae23e

Please sign in to comment.