List of utility methods to do Throwable to String
String | formatException(Throwable e) Formats an exception as a string for logging purposes Necessary because slf4j does not by default have a method for logging exceptions StringWriter writer = new StringWriter(); PrintWriter pwriter = new PrintWriter(writer); writer.append(e.getClass().getCanonicalName()); if (e.getMessage() != null) { writer.append(": "); writer.append(e.getMessage()); writer.append('\n'); ... |
String | formatException(Throwable t) format Exception ByteArrayOutputStream baos = new ByteArrayOutputStream(); PrintStream s = new PrintStream(baos); t.printStackTrace(s); return baos.toString(); |
String | formatException(Throwable t) Formats the given Throwable 's stack trace to a string StringWriter stringWriter = new StringWriter(); PrintWriter writer = new PrintWriter(stringWriter); t.printStackTrace(writer); return stringWriter.toString(); |
String | formatExceptionForDisplay(Exception e) format Exception For Display StringWriter sw = new StringWriter(); e.printStackTrace(new PrintWriter(sw)); return "<span style=\"color: red;\">An error occurred while searching for Mediasite content. Please contact your Blackboard administrator for more information.</span><!--<pre>" + sw.toString() + "</pre>-->"; |
String | formatThrowableForHtml(Throwable t) format Throwable For Html String ex = formatThrowable(t); return ex.replaceAll("\n\t", " "); |
CharSequence | formatThrown(final Throwable thrown) format Thrown if (thrown == null) return null; final StringBuilder buffer = new StringBuilder(); formatThrown(thrown, buffer); return buffer; |
String | getDetails(Throwable t) Returns a detailed message of the t, including the stack trace. assert t != null; StringWriter sw = new StringWriter(); t.printStackTrace(new PrintWriter(sw)); return t.getMessage() + "\n" + sw.toString(); |
String | getErrorInfo(Throwable error) get Error Info try { StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); error.printStackTrace(pw); return sw.toString(); } catch (Exception e1) { return ""; |
String | getErrorMessage(Throwable e) get Error Message Writer writer = new StringWriter(); PrintWriter pWriter = new PrintWriter(writer); e.printStackTrace(pWriter); return writer.toString(); |
String | getExceptionAsString(Throwable _ex) get Exception As String if (_ex == null) { return null; ByteArrayOutputStream baos = new ByteArrayOutputStream(); if (_ex.getStackTrace() == null) { _ex.fillInStackTrace(); _ex.printStackTrace(new PrintStream(baos)); ... |