richardstartin commented on a change in pull request #7460:
URL: https://github.com/apache/pinot/pull/7460#discussion_r713637989



##########
File path: 
pinot-common/src/main/java/org/apache/pinot/common/exception/QueryException.java
##########
@@ -144,17 +153,29 @@ public static ProcessingException 
getException(ProcessingException processingExc
     return copiedProcessingException;
   }
 
-  public static String getTruncatedStackTrace(Exception exception) {
+  public static String getTruncatedStackTrace(Throwable exception) {
     StringWriter stringWriter = new StringWriter();
     exception.printStackTrace(new PrintWriter(stringWriter));
     String fullStackTrace = stringWriter.toString();
     String[] lines = fullStackTrace.split("\n");

Review comment:
       I think it would be better not to do this by processing strings at ll 
and use the stack trace elements which will already have been filled in e.g.
   ```java
   StringBuilder sb = new StringBuilder();
   for (StackTraceElement frame : exception.getStackTrace()) {
     // maybe select frame
   }
   Throwable cause = exception.getCause();
   if (cause != null) {
     for (StackTraceElement frame : cause.getStackTrace()) {
       // maybe select frame
     }
   }
   for (Throwable s : exception.getSuppressed()) {
      for (StackTraceElement frame : s.getStackTrace() {
        // maybe select frame
     } 
   }
   ```




-- 
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