@Stability.Internal public class CbThrowables extends Object
Modifier and Type | Method and Description |
---|---|
static <T extends Throwable> |
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 String |
getStackTraceAsString(Throwable t) |
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 RuntimeException |
propagate(Throwable t)
Throws the given throwable if it is unchecked, otherwise throws
a new CouchbaseException with the given exception as a cause.
|
static <T extends Throwable> |
throwIfInstanceOf(Throwable t,
Class<T> clazz)
If the given Throwable is an instance of the given class, throw it.
|
static void |
throwIfUnchecked(Throwable t)
If the given Throwable is an instance of RuntimeException or Error, throw it.
|
public static <T extends Throwable> Optional<T> findCause(Throwable t, Class<T> type)
public static boolean hasCause(Throwable t, Class<? extends Throwable> type)
public static void throwIfUnchecked(Throwable t)
public static <T extends Throwable> void throwIfInstanceOf(Throwable t, Class<T> clazz) throws T extends Throwable
T extends Throwable
public static RuntimeException propagate(Throwable t)
Copyright © 2024 Couchbase, Inc.. All rights reserved.