ZhiQiang-Tiger commented on code in PR #2284:
URL: https://github.com/apache/fury/pull/2284#discussion_r2122803670


##########
java/fury-core/src/main/java/org/apache/fury/util/ExceptionUtils.java:
##########
@@ -57,15 +59,36 @@ public static StackOverflowError 
trySetStackOverflowErrorMessage(
 
   public static RuntimeException handleReadFailed(Fury fury, Throwable t) {
     if (fury.getRefResolver() instanceof MapRefResolver) {
-      ObjectArray readObjects = ((MapRefResolver) 
fury.getRefResolver()).getReadObjects();
-      // carry with read objects for better trouble shooting.
-      List<Object> objects = Arrays.asList(readObjects.objects).subList(0, 
readObjects.size);
-      throw new DeserializationException(objects, t);
+        List<Object> exceptionObjects = getExceptionObjects(fury);
+        throw new DeserializationException(exceptionObjects, t);
     } else {
       Platform.throwException(t);
       throw new IllegalStateException("unreachable");
     }
   }
 
+  public static List<Object> getExceptionObjects(Fury fury) {
+      ObjectArray readObjects = ((MapRefResolver) 
fury.getRefResolver()).getReadObjects();
+      // carry with read objects for better trouble shooting.
+      List<Object> objects = Arrays.asList(readObjects.objects).subList(0, 
readObjects.size);
+      switch (fury.getExceptionLogMode()) {
+        case NONE_PRINT:
+          return new ArrayList<>();
+        case SAMPLE_PRINT:

Review Comment:
   > how about limiting max samples instead of configuring sample step? Using 
step will print little things for small object, and still print lots of things 
for big object
   
   I think that the user will select a suitable log mode by judging the 
situation of the object. In other words,our design is scalable and we can 
employ multiple logging strategies to solve different situation.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to