Make exception in case a test tries to remote-log more informative.

--
MOS_MIGRATED_REVID=103290841
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 307544f..a727dec 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 @@
         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 4be1436..df1f92a 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 @@
           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 @@
               + 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 @@
           result.put(path, null);
         }
       }
-      return result;
+
+      // If some values are missing, return null.
+      return env.valuesMissing() ? null : result;
     }
   }