[engine] Improve error messages for missing/empty dirs #4517

Merged
merged 3 commits into from Apr 26, 2017

Conversation

Projects
None yet
3 participants
@baroquebobcat
Contributor

baroquebobcat commented Apr 25, 2017

Problem

When the engine has an issue finding BUILD files to fulfill a request for targets, it should have a good message even if the requested spec has no associated BUILD files.

Solution

This patch adds another error raising path to addresses_from_address_families so that missing directories and empty directories have improved error messages.

Result

The cases in #3912 for missing directories or directories without BUILD files have ok errors.

[engine] Improve error messages for missing/empty dirs
When the engine has an issue finding BUILD files to fulfill a request for targets, it should have a good message even if the requested spec has no associated BUILD files.

This patch adds another error raising path to addresses_from_address_families so that missing directories and empty directories have improved error messages

@baroquebobcat baroquebobcat requested review from stuhood and kwlzn Apr 25, 2017

@kwlzn

kwlzn approved these changes Apr 26, 2017

lgtm!

@stuhood

Nice. Thanks!

@@ -73,17 +73,24 @@ def _internal_scan_specs(self, specs, fail_fast=True, missing_is_fatal=True):
result = self._engine.execute(request)
if result.error:
raise self.BuildFileScanError(str(result.error))
- root_entries = self._scheduler.root_entries(request)
+ root_entries = result.root_products

This comment has been minimized.

@baroquebobcat

baroquebobcat Apr 26, 2017

Contributor

Noticed that the root_entries call here was unnecessary when covering the case where an unexpected Throw value is hit.

@baroquebobcat

baroquebobcat Apr 26, 2017

Contributor

Noticed that the root_entries call here was unnecessary when covering the case where an unexpected Throw value is hit.

@baroquebobcat baroquebobcat merged commit 7a7d7a1 into pantsbuild:master Apr 26, 2017

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

thesamet added a commit to thesamet/pants that referenced this pull request May 9, 2017

[engine] Improve error messages for missing/empty dirs (#4517)
### Problem
When the engine has an issue finding BUILD files to fulfill a request for targets, it should have a good message even if the requested spec has no associated BUILD files.

### Solution
This patch adds another error raising path to addresses_from_address_families so that missing directories and empty directories have improved error messages.
It also
* adds an error case for address mapper for unrelated Throws so that their associated exception's text will be reported if one is encountered instead of a missing field error.
* removes a needless call to scheduler.root_entries, which calls into the native engine.
### Result
The cases in #3912 for missing directories or directories without BUILD files have ok errors.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment