You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by GitBox <gi...@apache.org> on 2021/09/22 06:47:18 UTC

[GitHub] [pinot] richardstartin commented on a change in pull request #7460: add causes to stack trace return

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: commits-unsubscribe@pinot.apache.org

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



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org