public static String getUncaughtException(Throwable throwable){ StringWriter stringWriter = new StringWriter(); PrintWriter printWriter = new PrintWriter(stringWriter); throwable.printStackTrace(printWriter); printWriter.close(); String uncaughtException=stringWriter.toString(); return uncaughtException; }