diff options
author | 2015-09-15 19:37:11 +0000 | |
---|---|---|
committer | 2015-09-16 10:17:38 +0000 | |
commit | ac023bbcb127884e2c14c5c70848c61f149dfbbe (patch) | |
tree | 1a0cfc96e4fe1209fe3fc36535f45936823df44d /src/main/java/com/google/devtools/build/lib/skyframe/PackageFunction.java | |
parent | fe87155b7154f7ef64c7ab095071b148980f035f (diff) |
Get rid of transient errors during preprocessing and throw IOExceptions instead. Transient errors were only detected on IOExceptions, but preprocessing doesn't actually throw IOExceptions except if it fails before it even opens the main file, so there's no sense in trying to construct a package in that case.
--
MOS_MIGRATED_REVID=103119445
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.java | 19 |
1 files changed, 16 insertions, 3 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 95fef27c7e..2de3167e86 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 @@ -800,9 +800,22 @@ public class PackageFunction implements SkyFunction { packageId, packageLocator); Preprocessor.Result preprocessingResult = preprocessCache.getIfPresent(packageId); if (preprocessingResult == null) { - preprocessingResult = replacementSource == null - ? packageFactory.preprocess(packageId, buildFilePath, inputSource, globber) - : Preprocessor.Result.noPreprocessing(replacementSource); + try { + preprocessingResult = + replacementSource == null + ? packageFactory.preprocess(packageId, inputSource, globber) + : Preprocessor.Result.noPreprocessing(replacementSource); + } catch (IOException e) { + env + .getListener() + .handle( + Event.error( + Location.fromFile(buildFilePath), + "preprocessing failed: " + e.getMessage())); + throw new PackageFunctionException( + new BuildFileContainsErrorsException(packageId, "preprocessing failed", e), + Transience.TRANSIENT); + } preprocessCache.put(packageId, preprocessingResult); } |