Better debug log when error happens in expand queries

When we query sub responses, log down the url and error code, instead of just the response if an error occurs. This way we can instantly figure out where the error happened instead.

W0630 15:32:26.288392    3199 expand_query_aggregator.cc:65] Queried /foo/bar/baz/qux but got error code 500

#tlbmc

PiperOrigin-RevId: 777813797
Change-Id: I77da697f628ce6703db80cb1cc2583ee37774515
diff --git a/tlbmc/redfish/expand_query_aggregator.cc b/tlbmc/redfish/expand_query_aggregator.cc
index f5245f1..c594cf8 100644
--- a/tlbmc/redfish/expand_query_aggregator.cc
+++ b/tlbmc/redfish/expand_query_aggregator.cc
@@ -53,7 +53,7 @@
         // of the sub_async_resp.
         [expand_aggregator = shared_from_this(), url_to_expand](Response& res) {
           expand_aggregator->AddResponseToFinalResponse(
-              url_to_expand.json_pointer, res);
+              url_to_expand, res);
         });
     LOG(INFO) << "Sub request: " << sub_req.target();
     smart_router_->Handle(sub_req, sub_async_resp);
@@ -61,11 +61,11 @@
 }
 
 void ExpandQueryAggregator::AddResponseToFinalResponse(
-    const nlohmann::json::json_pointer& location, Response& sub_response) {
+    const ExpandNode& expand_node, Response& sub_response) {
   // Special handling for subresponse error
   if (sub_response.resultInt() < 200 || sub_response.resultInt() >= 400) {
-    DLOG(INFO) << "Sub response error: " << sub_response.resultInt() << " "
-               << sub_response.jsonValue.dump();
+    LOG(WARNING) << "Queried " << expand_node.url << " but got error code "
+                 << sub_response.resultInt();
     // Determine the final error code
     final_async_resp_->res.result(
         DetermineFinalErrorCode(sub_response.resultInt()));
@@ -80,7 +80,7 @@
     }
   }
 
-  final_async_resp_->res.jsonValue[location] =
+  final_async_resp_->res.jsonValue[expand_node.json_pointer] =
       std::move(sub_response.jsonValue);
 }
 
diff --git a/tlbmc/redfish/expand_query_aggregator.h b/tlbmc/redfish/expand_query_aggregator.h
index 3f70909..84670c6 100644
--- a/tlbmc/redfish/expand_query_aggregator.h
+++ b/tlbmc/redfish/expand_query_aggregator.h
@@ -54,7 +54,7 @@
   std::string CreateExpandQueryUrl(absl::string_view url,
                                    const ExpandNode& expand_node);
 
-  void AddResponseToFinalResponse(const nlohmann::json::json_pointer& location,
+  void AddResponseToFinalResponse(const ExpandNode& expand_node,
                                   ::crow::Response& sub_response);
 
   unsigned DetermineFinalErrorCode(unsigned sub_response_code);