public final class ExceptionsHelper extends Object
Constructor and Description |
---|
ExceptionsHelper() |
Modifier and Type | Method and Description |
---|---|
static ElasticsearchException |
convertToElastic(Throwable t) |
static RuntimeException |
convertToRuntime(Throwable t) |
static String |
detailedMessage(Throwable t) |
static String |
detailedMessage(Throwable t,
boolean newLines,
int initialCounter) |
static boolean |
isOOM(Throwable t)
Returns
true iff the given throwable is and OutOfMemoryException, otherwise false |
static <T extends Throwable> |
maybeThrowRuntimeAndSuppress(List<T> exceptions)
Throws a runtime exception with all given exceptions added as suppressed.
|
static <T extends Throwable> |
rethrowAndSuppress(List<T> exceptions)
Rethrows the first exception in the list and adds all remaining to the suppressed list.
|
static boolean |
reThrowIfNotNull(Throwable e)
Throws the specified exception.
|
static String |
stackTrace(Throwable e) |
static RestStatus |
status(Throwable t) |
static <T extends Throwable> |
unwrap(Throwable t,
Class<T> clazz) |
static Throwable |
unwrapCause(Throwable t) |
static IOException |
unwrapCorruption(Throwable t) |
static <T extends Throwable> |
useOrSupress(T first,
T second) |
public static RuntimeException convertToRuntime(Throwable t)
public static ElasticsearchException convertToElastic(Throwable t)
public static RestStatus status(Throwable t)
public static String detailedMessage(Throwable t, boolean newLines, int initialCounter)
public static <T extends Throwable> void rethrowAndSuppress(List<T> exceptions) throws T extends Throwable
T extends Throwable
public static <T extends Throwable> void maybeThrowRuntimeAndSuppress(List<T> exceptions)
public static <T extends Throwable> T useOrSupress(T first, T second)
public static IOException unwrapCorruption(Throwable t)
public static boolean isOOM(Throwable t)
true
iff the given throwable is and OutOfMemoryException, otherwise false
Copyright © 2009–2015. All rights reserved.