diff options
author | 2016-06-22 18:54:56 +0000 | |
---|---|---|
committer | 2016-06-23 11:10:13 +0000 | |
commit | 593d6560fafdf198da3a0ba7b108b6862747010e (patch) | |
tree | 23d5cdf1d463ff5b660310938c63094e063ef28a /src/main/java/com/google/devtools/build/lib/packages/WorkspaceFactory.java | |
parent | 4068a1d5aeb0493a6d333e691c5cb4f23be6f6dd (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/packages/WorkspaceFactory.java')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/packages/WorkspaceFactory.java | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/packages/WorkspaceFactory.java b/src/main/java/com/google/devtools/build/lib/packages/WorkspaceFactory.java index 95222c68ce..a5fe389f98 100644 --- a/src/main/java/com/google/devtools/build/lib/packages/WorkspaceFactory.java +++ b/src/main/java/com/google/devtools/build/lib/packages/WorkspaceFactory.java @@ -50,7 +50,6 @@ import com.google.devtools.build.lib.syntax.SkylarkSignatureProcessor; import com.google.devtools.build.lib.vfs.Path; import java.io.File; -import java.io.IOException; import java.util.Map; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -139,16 +138,16 @@ public class WorkspaceFactory { /** * Parses the given WORKSPACE file without resolving skylark imports. * - * <p>Called by com.google.devtools.build.workspace.Resolver from - * //src/tools/generate_workspace.</p> + * <p>Called by com.google.devtools.build.workspace.Resolver from //src/tools/generate_workspace. */ - public void parse(ParserInputSource source) throws InterruptedException, IOException { + public void parse(ParserInputSource source) + throws BuildFileContainsErrorsException, InterruptedException { parse(source, null); } @VisibleForTesting public void parse(ParserInputSource source, @Nullable StoredEventHandler localReporter) - throws InterruptedException, IOException { + throws BuildFileContainsErrorsException, InterruptedException { // This method is split in 2 so WorkspaceFileFunction can call the two parts separately and // do the Skylark load imports in between. We can't load skylark imports from // generate_workspace at the moment because it doesn't have access to skyframe, but that's okay @@ -158,7 +157,8 @@ public class WorkspaceFactory { } BuildFileAST buildFileAST = BuildFileAST.parseBuildFile(source, localReporter, false); if (buildFileAST.containsErrors()) { - throw new IOException("Failed to parse " + source.getPath()); + throw new BuildFileContainsErrorsException( + Label.EXTERNAL_PACKAGE_IDENTIFIER, "Failed to parse " + source.getPath()); } execute(buildFileAST, null, localReporter); } |