Package io.dropwizard.util
Class Throwables
- java.lang.Object
-
- io.dropwizard.util.Throwables
-
public final class Throwables extends Object
- Since:
- 2.0
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static ThrowablegetRootCause(Throwable throwable)Returns the innermost cause ofthrowable.
-
-
-
Method Detail
-
getRootCause
public static Throwable getRootCause(Throwable throwable)
Returns the innermost cause ofthrowable. 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
-
-