From 593d6560fafdf198da3a0ba7b108b6862747010e Mon Sep 17 00:00:00 2001 From: Janak Ramakrishnan Date: Wed, 22 Jun 2016 18:54:56 +0000 Subject: 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 --- .../devtools/build/lib/skyframe/WorkspaceASTFunction.java | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'src/main/java/com/google/devtools/build/lib/skyframe/WorkspaceASTFunction.java') 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)); -- cgit v1.2.3