aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/skyframe/PackageFunction.java
diff options
context:
space:
mode:
authorGravatar nharmata <nharmata@google.com>2017-06-16 00:26:27 +0200
committerGravatar Yun Peng <pcloudy@google.com>2017-06-16 09:27:24 +0200
commitbea67e9e7bc5b25dc0569bc429d92434a76b9a84 (patch)
treed0f71a262248ffe4676fd746a428fc1c1f6ce48e /src/main/java/com/google/devtools/build/lib/skyframe/PackageFunction.java
parent0bd2102ea33f8c1bc40fbfb2acabcd46895011f3 (diff)
A bunch of unrelated cleanups:
-Have SkylarkImportLookupFunction include causes in the SkyFunctionExceptions it throws. -Better transitive skyframe error declarations in ASTFileLookupFunction. -Have ErrorInfo differentiate between direct and transitive transience. -Introduce ErrorInfoManager and have ParallelEvaluator/ParallelEvaluatorContext use it. RELNOTES: None PiperOrigin-RevId: 159163186
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/skyframe/PackageFunction.java')
-rw-r--r--src/main/java/com/google/devtools/build/lib/skyframe/PackageFunction.java15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/PackageFunction.java b/src/main/java/com/google/devtools/build/lib/skyframe/PackageFunction.java
index b5cb5b827e..15e21e3bb9 100644
--- a/src/main/java/com/google/devtools/build/lib/skyframe/PackageFunction.java
+++ b/src/main/java/com/google/devtools/build/lib/skyframe/PackageFunction.java
@@ -13,6 +13,7 @@
// limitations under the License.
package com.google.devtools.build.lib.skyframe;
+import com.google.common.base.Throwables;
import com.google.common.cache.Cache;
import com.google.common.collect.ImmutableCollection;
import com.google.common.collect.ImmutableList;
@@ -633,6 +634,16 @@ public class PackageFunction implements SkyFunction {
return buildFileValue;
}
+ private static BuildFileContainsErrorsException propagateSkylarkImportFailedException(
+ PackageIdentifier packageId, SkylarkImportFailedException e)
+ throws BuildFileContainsErrorsException {
+ Throwable rootCause = Throwables.getRootCause(e);
+ throw (rootCause instanceof IOException)
+ ? new BuildFileContainsErrorsException(
+ packageId, e.getMessage(), (IOException) rootCause)
+ : new BuildFileContainsErrorsException(packageId, e.getMessage());
+ }
+
/**
* Fetch the skylark loads for this BUILD file. If any of them haven't been computed yet,
* returns null.
@@ -667,7 +678,7 @@ public class PackageFunction implements SkyFunction {
return null;
}
} catch (SkylarkImportFailedException e) {
- throw new BuildFileContainsErrorsException(packageId, e.getMessage());
+ throw propagateSkylarkImportFailedException(packageId, e);
}
// Look up and load the imports.
@@ -721,7 +732,7 @@ public class PackageFunction implements SkyFunction {
}
} catch (SkylarkImportFailedException e) {
- throw new BuildFileContainsErrorsException(packageId, e.getMessage());
+ throw propagateSkylarkImportFailedException(packageId, e);
} catch (InconsistentFilesystemException e) {
throw new NoSuchPackageException(packageId, e.getMessage(), e);
}