Package com.couchbase.client.core.util
Class CbThrowables
java.lang.Object
com.couchbase.client.core.util.CbThrowables
-
Method Summary
Modifier and TypeMethodDescriptionWalks 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 String
static boolean
Returns true if the given throwable or any throwable in its causal chain is an instance of the given type.static RuntimeException
Throws the given throwable if it is unchecked, otherwise throws a new CouchbaseException with the given exception as a cause.static <T extends Throwable>
voidthrowIfInstanceOf
(Throwable t, Class<T> clazz) If the given Throwable is an instance of the given class, throw it.static void
If the given Throwable is an instance of RuntimeException or Error, throw it.
-
Method Details
-
findCause
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
Returns true if the given throwable or any throwable in its causal chain is an instance of the given type. -
throwIfUnchecked
If the given Throwable is an instance of RuntimeException or Error, throw it. Otherwise do nothing. -
throwIfInstanceOf
If the given Throwable is an instance of the given class, throw it. Otherwise do nothing.- Throws:
T
-
propagate
Throws the given throwable if it is unchecked, otherwise throws a new CouchbaseException with the given exception as a cause.- Returns:
- this function always throws an exception, and never returns a value
-
getStackTraceAsString
-