Package com.couchbase.client.core.util
Class CbThrowables
- java.lang.Object
-
- com.couchbase.client.core.util.CbThrowables
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T extends Throwable>
Optional<T>findCause(Throwable t, Class<T> type)
Walks the causal chain of the given throwable (starting with the given throwable itself) and returns the first throwable that is an instance of the specified type.static boolean
hasCause(Throwable t, Class<? extends Throwable> type)
Returns true if the given throwable or any throwable in its causal chain is an instance of the given type.static void
throwIfUnchecked(Throwable t)
If the given Throwable is an instance of RuntimeException, throw it.
-
-
-
Method Detail
-
findCause
public static <T extends Throwable> Optional<T> findCause(Throwable t, Class<T> type)
Walks the causal chain of the given throwable (starting with the given throwable itself) and returns the first throwable that is an instance of the specified type.
-
hasCause
public static boolean hasCause(Throwable t, Class<? extends Throwable> type)
Returns true if the given throwable or any throwable in its causal chain is an instance of the given type.
-
throwIfUnchecked
public static void throwIfUnchecked(Throwable t)
If the given Throwable is an instance of RuntimeException, throw it. Otherwise do nothing.
-
-