Fokko commented on code in PR #8760:
URL: https://github.com/apache/iceberg/pull/8760#discussion_r1352239032


##########
core/src/main/java/org/apache/iceberg/rest/responses/ErrorResponseParser.java:
##########
@@ -76,17 +76,20 @@ public static ErrorResponse fromJson(JsonNode jsonNode) {
         jsonNode != null && jsonNode.isObject(),
         "Cannot parse error response from non-object value: %s",
         jsonNode);
-    Preconditions.checkArgument(jsonNode.has(ERROR), "Cannot parse missing 
field: error");
-    JsonNode error = JsonUtil.get(ERROR, jsonNode);
-    String message = JsonUtil.getStringOrNull(MESSAGE, error);
-    String type = JsonUtil.getStringOrNull(TYPE, error);
-    Integer code = JsonUtil.getIntOrNull(CODE, error);
-    List<String> stack = JsonUtil.getStringListOrNull(STACK, error);
-    return ErrorResponse.builder()
-        .withMessage(message)
-        .withType(type)
-        .responseCode(code)
-        .withStackTrace(stack)
-        .build();
+    if (jsonNode.has(ERROR)) {
+      JsonNode error = JsonUtil.get(ERROR, jsonNode);
+      String message = JsonUtil.getStringOrNull(MESSAGE, error);
+      String type = JsonUtil.getStringOrNull(TYPE, error);
+      Integer code = JsonUtil.getIntOrNull(CODE, error);
+      List<String> stack = JsonUtil.getStringListOrNull(STACK, error);
+      return ErrorResponse.builder()
+          .withMessage(message)
+          .withType(type)
+          .responseCode(code)
+          .withStackTrace(stack)
+          .build();
+    } else {
+      return ErrorResponse.builder().build();
+    }

Review Comment:
   We can also update the spec, but it looks like not all systems (EMR) are 
sending the full message. The question is, do we want to fail at parsing the 
error message, or just return an empty message (or throw an exception somewhere 
else).



-- 
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: issues-unsubscr...@iceberg.apache.org

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


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

Reply via email to