diff --git a/src/main/java/com/google/devtools/build/lib/query2/cquery/ConfiguredTargetAccessor.java b/src/main/java/com/google/devtools/build/lib/query2/cquery/ConfiguredTargetAccessor.java index 09552325e9db72..effb45670025eb 100644 --- a/src/main/java/com/google/devtools/build/lib/query2/cquery/ConfiguredTargetAccessor.java +++ b/src/main/java/com/google/devtools/build/lib/query2/cquery/ConfiguredTargetAccessor.java @@ -131,8 +131,8 @@ public List getPrerequisites( throw new QueryException( caller, String.format( - "%s %s of type %s does not have attribute '%s'", - errorMsgPrefix, actualConfiguredTarget, rule.getRuleClass(), attrName), + "%sconfigured target of type %s does not have attribute '%s'", + errorMsgPrefix, rule.getRuleClass(), attrName), ConfigurableQuery.Code.ATTRIBUTE_MISSING); } ImmutableList.Builder toReturn = ImmutableList.builder(); diff --git a/src/test/java/com/google/devtools/build/lib/query2/cquery/ConfiguredTargetQuerySemanticsTest.java b/src/test/java/com/google/devtools/build/lib/query2/cquery/ConfiguredTargetQuerySemanticsTest.java index 688550c9f2b499..e4b78705b774f8 100644 --- a/src/test/java/com/google/devtools/build/lib/query2/cquery/ConfiguredTargetQuerySemanticsTest.java +++ b/src/test/java/com/google/devtools/build/lib/query2/cquery/ConfiguredTargetQuerySemanticsTest.java @@ -160,18 +160,13 @@ public void testLabelsFunction_labelListAttribute() throws Exception { public void testLabelsFunction_errorsOnBadAttribute() throws Exception { setUpLabelsFunctionTests(); - ConfiguredTarget myRule = Iterables.getOnlyElement(eval("//test:my_rule")); - String targetConfiguration = myRule.getConfigurationChecksum(); - // Test that the proper error is thrown when requesting an attribute that doesn't exist. EvalThrowsResult evalThrowsResult = evalThrows("labels('fake_attr', //test:my_rule)", true); assertConfigurableQueryCode(evalThrowsResult.getFailureDetail(), Code.ATTRIBUTE_MISSING); assertThat(evalThrowsResult.getMessage()) .isEqualTo( - String.format( - "in 'fake_attr' of rule //test:my_rule: ConfiguredTarget(//test:my_rule, %s) " - + "of type rule_with_transitions does not have attribute 'fake_attr'", - targetConfiguration)); + "in 'fake_attr' of rule //test:my_rule: configured target of type" + + " rule_with_transitions does not have attribute 'fake_attr'"); } @Test