aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/skyframe/WorkspaceASTFunction.java
diff options
context:
space:
mode:
authorGravatar Janak Ramakrishnan <janakr@google.com>2016-06-22 18:54:56 +0000
committerGravatar Lukacs Berki <lberki@google.com>2016-06-23 11:10:13 +0000
commit593d6560fafdf198da3a0ba7b108b6862747010e (patch)
tree23d5cdf1d463ff5b660310938c63094e063ef28a /src/main/java/com/google/devtools/build/lib/skyframe/WorkspaceASTFunction.java
parent4068a1d5aeb0493a6d333e691c5cb4f23be6f6dd (diff)
Get rid of a bunch of IOExceptions that were being unnecessarily thrown. We don't want to throw IOExceptions unless there is an actual IOException. Syntax errors in WORKSPACE files don't qualify, and neither do badly written Skylark rules. I may have misunderstood some code here, so please do push back if the root causes here really can be filesystem issues.
-- MOS_MIGRATED_REVID=125591177
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/skyframe/WorkspaceASTFunction.java')
-rw-r--r--src/main/java/com/google/devtools/build/lib/skyframe/WorkspaceASTFunction.java13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/WorkspaceASTFunction.java b/src/main/java/com/google/devtools/build/lib/skyframe/WorkspaceASTFunction.java
index d101139028..891f895e2d 100644
--- a/src/main/java/com/google/devtools/build/lib/skyframe/WorkspaceASTFunction.java
+++ b/src/main/java/com/google/devtools/build/lib/skyframe/WorkspaceASTFunction.java
@@ -15,6 +15,8 @@
package com.google.devtools.build.lib.skyframe;
import com.google.common.collect.ImmutableList;
+import com.google.devtools.build.lib.cmdline.Label;
+import com.google.devtools.build.lib.packages.BuildFileContainsErrorsException;
import com.google.devtools.build.lib.packages.RuleClassProvider;
import com.google.devtools.build.lib.syntax.BuildFileAST;
import com.google.devtools.build.lib.syntax.LoadStatement;
@@ -59,14 +61,18 @@ public class WorkspaceASTFunction implements SkyFunction {
env.getListener(), false);
if (ast.containsErrors()) {
throw new WorkspaceASTFunctionException(
- new IOException("Failed to parse default WORKSPACE file"), Transience.PERSISTENT);
+ new BuildFileContainsErrorsException(
+ Label.EXTERNAL_PACKAGE_IDENTIFIER, "Failed to parse default WORKSPACE file"),
+ Transience.PERSISTENT);
}
if (workspaceFileValue.exists()) {
ast = BuildFileAST.parseBuildFile(
ParserInputSource.create(repoWorkspace), ast.getStatements(), env.getListener(), false);
if (ast.containsErrors()) {
throw new WorkspaceASTFunctionException(
- new IOException("Failed to parse WORKSPACE file"), Transience.PERSISTENT);
+ new BuildFileContainsErrorsException(
+ Label.EXTERNAL_PACKAGE_IDENTIFIER, "Failed to parse WORKSPACE file"),
+ Transience.PERSISTENT);
}
}
ast = BuildFileAST.parseBuildFile(
@@ -77,7 +83,8 @@ public class WorkspaceASTFunction implements SkyFunction {
false);
if (ast.containsErrors()) {
throw new WorkspaceASTFunctionException(
- new IOException("Failed to parse default WORKSPACE file suffix"),
+ new BuildFileContainsErrorsException(
+ Label.EXTERNAL_PACKAGE_IDENTIFIER, "Failed to parse default WORKSPACE file suffix"),
Transience.PERSISTENT);
}
return new WorkspaceASTValue(splitAST(ast));