List of usage examples for org.apache.commons.lang.exception ExceptionUtils getThrowableCount
public static int getThrowableCount(Throwable throwable)
Counts the number of Throwable
objects in the exception chain.
A throwable without cause will return 1
.
From source file:MainClass.java
public static void main(String[] args) { try {/*from ww w. ja v a2 s . c om*/ a(); } catch (Exception e) { System.out.println("Number of Throwable objects in the exception chain is: " + ExceptionUtils.getThrowableCount(e)); e.printStackTrace(); } }
From source file:ExceptionTrial.java
public static void main(String[] args) { try {//from w ww. ja v a 2 s .c om middleMeth(); } catch (Exception e) { System.out.println("Number of Throwable objects in the exception chain is: " + ExceptionUtils.getThrowableCount(e)); e.printStackTrace(); } }