public final class Throwables extends Object
Modifier and Type | Method and Description |
---|---|
static Throwable |
getRootCause(Throwable throwable)
Returns the innermost cause of
throwable . |
public static Throwable getRootCause(Throwable throwable)
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());
IllegalArgumentException
- if there is a loop in the causal chainCopyright © 2019. All rights reserved.