Skip to content

Commit

Permalink
[LIVY-688] Error message of BypassJobStatus should contains cause inf…
Browse files Browse the repository at this point in the history
…ormation 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 <[email protected]>

Closes apache#237 from WeiWenda/livy-err-clear.
  • Loading branch information
WeiWenda authored and jerryshao committed Sep 29, 2019
1 parent 6c53d2b commit 0ea4a14
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions rsc/src/main/java/org/apache/livy/rsc/Utils.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -91,13 +93,9 @@ public static String join(Iterable<String> strs, String sep) {
}

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) {
Expand Down

0 comments on commit 0ea4a14

Please sign in to comment.