Fix a bug, when we have dependency from one aspect to another aspect1->aspect2 and aspect2 fails then aspect1 throws IllegalStateException.

--
MOS_MIGRATED_REVID=102976139
diff --git a/src/test/java/com/google/devtools/build/lib/analysis/AspectTest.java b/src/test/java/com/google/devtools/build/lib/analysis/AspectTest.java
index 02b4f3e..b051db1 100644
--- a/src/test/java/com/google/devtools/build/lib/analysis/AspectTest.java
+++ b/src/test/java/com/google/devtools/build/lib/analysis/AspectTest.java
@@ -126,6 +126,29 @@
   }
 
   @Test
+  public void transitiveAspectInError() throws Exception {
+    setRules(new TestAspects.BaseRule(), new TestAspects.ErrorAspectRule(),
+        new TestAspects.SimpleRule());
+
+    pkg("a",
+        "error_aspect(name='a', foo=[':b'])",
+        "error_aspect(name='b', bar=[':c'])",
+        "error_aspect(name='c', bar=[':d'])",
+        "error_aspect(name='d')");
+
+    reporter.removeHandler(failFastHandler);
+    // getConfiguredTarget() uses a separate code path that does not hit
+    // SkyframeBuildView#configureTargets
+    try {
+      update("//a:a");
+      fail();
+    } catch (ViewCreationFailedException e) {
+      // expected
+    }
+    assertContainsEvent("Aspect error");
+  }
+
+  @Test
   public void sameTargetInDifferentAttributes() throws Exception {
     setRules(new TestAspects.BaseRule(), new TestAspects.AspectRequiringRule(),
         new TestAspects.SimpleRule());