Here you can find the source of exception(Throwable t)
Parameter | Description |
---|---|
t | the Throwable to format. |
public static String exception(Throwable t)
//package com.java2s; //License from project: Open Source License public class Main { /**/*from w ww . ja v a2 s. c o m*/ * Constructs a pretty one line version of a {@link Throwable}. Useful for * debugging. * * @param t the {@link Throwable} to format. * @return a string representing information about the {@link Throwable} */ public static String exception(Throwable t) { // TODO: We should use clear manually written exceptions StackTraceElement[] trace = t.getStackTrace(); return t.getClass().getSimpleName() + " : " + t.getMessage() + ((trace.length > 0) ? " @ " + t.getStackTrace()[0].getClassName() + ":" + t.getStackTrace()[0].getLineNumber() : ""); } }