diff options
author | Kristina Chodorow <kchodorow@google.com> | 2016-05-05 19:06:12 +0000 |
---|---|---|
committer | Damien Martin-Guillerez <dmarting@google.com> | 2016-05-06 09:29:37 +0000 |
commit | 22b7dc4473b1a293de55199ff7aa2ddce5e28827 (patch) | |
tree | fc98edf988808223aa41764dcfcf24acfd8eeb24 /src/main/java/com/google/devtools/build/lib/skyframe/ASTFileLookupFunction.java | |
parent | fdc9a1e3bf10ee256edd142f86965dfc63099168 (diff) |
Catch package lookup exceptions during AST lookup
Noticed this while debugging #1228. Referencing a non-existent
(BuildFileNotFoundException) package would print "Loading failed; build aborted"
with no error message about what had actually gone wrong.
--
MOS_MIGRATED_REVID=121602225
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/skyframe/ASTFileLookupFunction.java')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/skyframe/ASTFileLookupFunction.java | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/ASTFileLookupFunction.java b/src/main/java/com/google/devtools/build/lib/skyframe/ASTFileLookupFunction.java index e0bafdfd46..201891939a 100644 --- a/src/main/java/com/google/devtools/build/lib/skyframe/ASTFileLookupFunction.java +++ b/src/main/java/com/google/devtools/build/lib/skyframe/ASTFileLookupFunction.java @@ -15,6 +15,7 @@ package com.google.devtools.build.lib.skyframe; import com.google.devtools.build.lib.cmdline.Label; +import com.google.devtools.build.lib.packages.BuildFileNotFoundException; import com.google.devtools.build.lib.packages.RuleClassProvider; import com.google.devtools.build.lib.syntax.BuildFileAST; import com.google.devtools.build.lib.syntax.Mutability; @@ -60,7 +61,15 @@ public class ASTFileLookupFunction implements SkyFunction { // SkyKey pkgSkyKey = PackageLookupValue.key(fileLabel.getPackageIdentifier()); PackageLookupValue pkgLookupValue = null; - pkgLookupValue = (PackageLookupValue) env.getValue(pkgSkyKey); + try { + pkgLookupValue = (PackageLookupValue) env.getValueOrThrow( + pkgSkyKey, BuildFileNotFoundException.class, InconsistentFilesystemException.class); + } catch (BuildFileNotFoundException e) { + throw new ASTLookupFunctionException( + new ErrorReadingSkylarkExtensionException(e), Transience.PERSISTENT); + } catch (InconsistentFilesystemException e) { + throw new ASTLookupFunctionException(e, Transience.PERSISTENT); + } if (pkgLookupValue == null) { return null; } |