diff options
author | Janak Ramakrishnan <janakr@google.com> | 2015-09-17 15:07:26 +0000 |
---|---|---|
committer | David Chen <dzc@google.com> | 2015-09-17 19:35:54 +0000 |
commit | a88e65b52c38b23ff20966adb76e13f97c5770f5 (patch) | |
tree | e16267995da98b4938816a4d4a9fc7e96166c1dd /src/main/java/com/google | |
parent | afc93a6645d6c8b5be933b48137ac5d0c6aafd61 (diff) |
Make exception in case a test tries to remote-log more informative.
--
MOS_MIGRATED_REVID=103290841
Diffstat (limited to 'src/main/java/com/google')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/runtime/BlazeRuntime.java | 12 | ||||
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/skyframe/ActionExecutionFunction.java | 14 |
2 files changed, 17 insertions, 9 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/runtime/BlazeRuntime.java b/src/main/java/com/google/devtools/build/lib/runtime/BlazeRuntime.java index 307544f11e..a727decee6 100644 --- a/src/main/java/com/google/devtools/build/lib/runtime/BlazeRuntime.java +++ b/src/main/java/com/google/devtools/build/lib/runtime/BlazeRuntime.java @@ -1384,14 +1384,18 @@ public final class BlazeRuntime { new Handler() { @Override public void publish(LogRecord record) { - throw new IllegalStateException( + Throwable e = record.getThrown(); + String message = record.getSourceClassName() + "#" + record.getSourceMethodName() + ": " - + record.getMessage() - + "\n" - + record.getThrown()); + + record.getMessage(); + if (e == null) { + throw new IllegalStateException(message); + } else { + throw new IllegalStateException(message, e); + } } @Override diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/ActionExecutionFunction.java b/src/main/java/com/google/devtools/build/lib/skyframe/ActionExecutionFunction.java index 4be1436aa3..df1f92a3be 100644 --- a/src/main/java/com/google/devtools/build/lib/skyframe/ActionExecutionFunction.java +++ b/src/main/java/com/google/devtools/build/lib/skyframe/ActionExecutionFunction.java @@ -276,10 +276,8 @@ public class ActionExecutionFunction implements SkyFunction, CompletionReceiver ValueOrException2<NoSuchPackageException, InconsistentFilesystemException>> values = env.getValuesOrThrow(depKeys.values(), NoSuchPackageException.class, InconsistentFilesystemException.class); - if (env.valuesMissing()) { - // Some values are not computed yet. - return null; - } + // Check values even if some are missing so that we can throw an appropriate exception if + // needed. Map<PathFragment, Root> result = new HashMap<>(); for (PathFragment path : execPaths) { @@ -291,6 +289,10 @@ public class ActionExecutionFunction implements SkyFunction, CompletionReceiver + path, e); } + if (value == null) { + Preconditions.checkState(env.valuesMissing(), path); + continue; + } if (value.hasContainingPackage()) { // We have found corresponding root for current execPath. result.put(path, Root.asSourceRoot(value.getContainingPackageRoot())); @@ -299,7 +301,9 @@ public class ActionExecutionFunction implements SkyFunction, CompletionReceiver result.put(path, null); } } - return result; + + // If some values are missing, return null. + return env.valuesMissing() ? null : result; } } |