aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/skyframe/PackageLookupFunction.java
diff options
context:
space:
mode:
authorGravatar ulfjack <ulfjack@google.com>2018-01-12 02:11:17 -0800
committerGravatar Copybara-Service <copybara-piper@google.com>2018-01-12 08:19:06 -0800
commite4794532730ce1df4072a23f9fd5209bcc2cb3e6 (patch)
tree8e224d1015b6da30497b3dffe662149ab7ce78aa /src/main/java/com/google/devtools/build/lib/skyframe/PackageLookupFunction.java
parent3e379d1479b2de6118b16aa33f6b9b6fd4ac6ab0 (diff)
Make FileSymlinkException and InconsistentFSException IOExceptions
Most places handle them the same way as IOException, which seems like a safe default. The places that do care can still throw or catch the more specific type. PiperOrigin-RevId: 181719688
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/skyframe/PackageLookupFunction.java')
-rw-r--r--src/main/java/com/google/devtools/build/lib/skyframe/PackageLookupFunction.java19
1 files changed, 9 insertions, 10 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/PackageLookupFunction.java b/src/main/java/com/google/devtools/build/lib/skyframe/PackageLookupFunction.java
index 6c29df3fe7..00d0c34f19 100644
--- a/src/main/java/com/google/devtools/build/lib/skyframe/PackageLookupFunction.java
+++ b/src/main/java/com/google/devtools/build/lib/skyframe/PackageLookupFunction.java
@@ -146,8 +146,15 @@ public class PackageLookupFunction implements SkyFunction {
SkyKey fileSkyKey = FileValue.key(fileRootedPath);
FileValue fileValue = null;
try {
- fileValue = (FileValue) env.getValueOrThrow(fileSkyKey, IOException.class,
- FileSymlinkException.class, InconsistentFilesystemException.class);
+ fileValue = (FileValue) env.getValueOrThrow(fileSkyKey, IOException.class);
+ } catch (InconsistentFilesystemException e) {
+ // This error is not transient from the perspective of the PackageLookupFunction.
+ throw new PackageLookupFunctionException(e, Transience.PERSISTENT);
+ } catch (FileSymlinkException e) {
+ throw new PackageLookupFunctionException(new BuildFileNotFoundException(packageIdentifier,
+ "Symlink cycle detected while trying to find " + basename + " file "
+ + fileRootedPath.asPath()),
+ Transience.PERSISTENT);
} catch (IOException e) {
// TODO(bazel-team): throw an IOException here and let PackageFunction wrap that into a
// BuildFileNotFoundException.
@@ -155,14 +162,6 @@ public class PackageLookupFunction implements SkyFunction {
"IO errors while looking for " + basename + " file reading "
+ fileRootedPath.asPath() + ": " + e.getMessage(), e),
Transience.PERSISTENT);
- } catch (FileSymlinkException e) {
- throw new PackageLookupFunctionException(new BuildFileNotFoundException(packageIdentifier,
- "Symlink cycle detected while trying to find " + basename + " file "
- + fileRootedPath.asPath()),
- Transience.PERSISTENT);
- } catch (InconsistentFilesystemException e) {
- // This error is not transient from the perspective of the PackageLookupFunction.
- throw new PackageLookupFunctionException(e, Transience.PERSISTENT);
}
return fileValue;
}