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 ShardOperationFailedException[] |
groupBy(ShardOperationFailedException[] failures)
Deduplicate the failures by exception message and index.
|
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 Throwable |
unwrap(Throwable t,
Class<?>... clazzes) |
static Throwable |
unwrapCause(Throwable t) |
static IOException |
unwrapCorruption(Throwable t) |
static <T extends Throwable> |
useOrSuppress(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 useOrSuppress(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
public static boolean reThrowIfNotNull(@Nullable Throwable e)
true
is returned.public static ShardOperationFailedException[] groupBy(ShardOperationFailedException[] failures)
Copyright © 2009–2016. All rights reserved.