Class Throwables


  • public final class Throwables
    extends Object
    Since:
    2.0
    • Method Detail

      • getRootCause

        public static Throwable getRootCause​(Throwable throwable)
        Returns the innermost cause of throwable. The first throwable in a chain provides context from when the error or exception was initially detected. Example usage:
         assertEquals("Unable to assign a customer id", Throwables.getRootCause(e).getMessage());
         
        Throws:
        IllegalArgumentException - if there is a loop in the causal chain