You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@livy.apache.org by js...@apache.org on 2019/09/29 08:20:19 UTC

[incubator-livy] branch master updated: [LIVY-688] Error message of BypassJobStatus should contains cause information of Exception

This is an automated email from the ASF dual-hosted git repository.

jshao pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-livy.git


The following commit(s) were added to refs/heads/master by this push:
     new 0ea4a14  [LIVY-688] Error message of BypassJobStatus should contains cause information of Exception
0ea4a14 is described below

commit 0ea4a14fcd77a954898f58b4a624d0d515b52eda
Author: weiwenda <we...@qq.com>
AuthorDate: Sun Sep 29 16:19:41 2019 +0800

    [LIVY-688] Error message of BypassJobStatus should contains cause information of Exception
    
    ## What changes were proposed in this pull request?
    Change the implement of org.apache.livy.rsc.Utils.stackTraceAsString to guava Throwables.getStackTraceAsString, so that user can receive details of error message by calling org.apache.livy.client.http.JobHandleImpl.get.
    
    https://issues.apache.org/jira/browse/LIVY-688
    
    Author: weiwenda <we...@qq.com>
    
    Closes #237 from WeiWenda/livy-err-clear.
---
 rsc/src/main/java/org/apache/livy/rsc/Utils.java | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/rsc/src/main/java/org/apache/livy/rsc/Utils.java b/rsc/src/main/java/org/apache/livy/rsc/Utils.java
index d2c0059..3c8a5e6 100644
--- a/rsc/src/main/java/org/apache/livy/rsc/Utils.java
+++ b/rsc/src/main/java/org/apache/livy/rsc/Utils.java
@@ -17,6 +17,8 @@
 
 package org.apache.livy.rsc;
 
+import java.io.PrintWriter;
+import java.io.StringWriter;
 import java.util.concurrent.ThreadFactory;
 import java.util.concurrent.atomic.AtomicInteger;
 
@@ -91,13 +93,9 @@ public class Utils {
   }
 
   public static String stackTraceAsString(Throwable t) {
-    StringBuilder sb = new StringBuilder();
-    sb.append(t.getClass().getName()).append(": ").append(t.getMessage());
-    for (StackTraceElement e : t.getStackTrace()) {
-      sb.append("\n");
-      sb.append(e.toString());
-    }
-    return sb.toString();
+    StringWriter stringWriter = new StringWriter();
+    t.printStackTrace(new PrintWriter(stringWriter));
+    return stringWriter.toString();
   }
 
   public static <T> void addListener(Future<T> future, final FutureListener<T> lsnr) {