wary commented on code in PR #309:
URL: 
https://github.com/apache/doris-spark-connector/pull/309#discussion_r2048727438


##########
spark-doris-connector/spark-doris-connector-base/src/main/java/org/apache/doris/spark/client/DorisFrontendClient.java:
##########
@@ -114,7 +115,13 @@ private List<Frontend> initFrontends(DorisConfig config) 
throws Exception {
                                         + ", reason: " + 
response.getStatusLine().getReasonPhrase());
                             }
                             String entity = 
EntityUtils.toString(response.getEntity());
-                            dataNode = extractEntity(entity, "data");
+                                                       LOG.info("get response: 
{} with fe request url: {}", entity,  feReqURL);
+                            JsonNode respNode = MAPPER.readTree(entity);
+                            String code = respNode.get("code").asText();
+                            if(!"0".equalsIgnoreCase(code)) {
+                                throw new RuntimeException("fetch fe request 
with invalid code, response: " + entity);
+                            }
+                            dataNode = respNode.get("data");

Review Comment:
   Add a common method extractDataFromResponse and handle all http response 
with it.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to