Convert Throwable to string
import java.io.PrintWriter; import java.io.StringWriter; public class Utils { public static String toString(Throwable th) { StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); th.printStackTrace(pw); return sw.toString(); } }