Here you can find the source of formatException(final Exception e)
Parameter | Description |
---|---|
e | Exception for format as error message |
public static String formatException(final Exception e)
//package com.java2s; //License from project: Open Source License public class Main { /**// w w w. j a v a 2 s. co m * Formats the given exception in a multiline error message with all causes. * * @param e * Exception for format as error message * @return Returns an error string */ public static String formatException(final Exception e) { final StringBuilder sb = new StringBuilder(); Throwable t = e; while (t != null) { sb.append(t.getMessage()).append("\n"); t = t.getCause(); } return sb.toString(); } }