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 were 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
  • Loading branch information
fmeum committed Dec 23, 2022
1 parent 051c9a5 commit d6dce0b
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 d6dce0b

Please sign in to comment.