public final class ExceptionsHelper
extends java.lang.Object
Constructor and Description |
---|
ExceptionsHelper() |
Modifier and Type | Method and Description |
---|---|
static ElasticsearchException |
convertToElastic(java.lang.Throwable t) |
static java.lang.RuntimeException |
convertToRuntime(java.lang.Throwable t) |
static java.lang.String |
detailedMessage(java.lang.Throwable t) |
static java.lang.String |
detailedMessage(java.lang.Throwable t,
boolean newLines,
int initialCounter) |
static ShardOperationFailedException[] |
groupBy(ShardOperationFailedException[] failures)
Deduplicate the failures by exception message and index.
|
static boolean |
isOOM(java.lang.Throwable t)
Returns
true iff the given throwable is and OutOfMemoryException, otherwise false |
static <T extends java.lang.Throwable> |
maybeThrowRuntimeAndSuppress(java.util.List<T> exceptions)
Throws a runtime exception with all given exceptions added as suppressed.
|
static <T extends java.lang.Throwable> |
rethrowAndSuppress(java.util.List<T> exceptions)
Rethrows the first exception in the list and adds all remaining to the suppressed list.
|
static boolean |
reThrowIfNotNull(java.lang.Throwable e)
Throws the specified exception.
|
static java.lang.String |
stackTrace(java.lang.Throwable e) |
static RestStatus |
status(java.lang.Throwable t) |
static java.lang.Throwable |
unwrap(java.lang.Throwable t,
java.lang.Class<?>... clazzes) |
static java.lang.Throwable |
unwrapCause(java.lang.Throwable t) |
static java.io.IOException |
unwrapCorruption(java.lang.Throwable t) |
static <T extends java.lang.Throwable> |
useOrSuppress(T first,
T second) |
public static java.lang.RuntimeException convertToRuntime(java.lang.Throwable t)
public static ElasticsearchException convertToElastic(java.lang.Throwable t)
public static RestStatus status(java.lang.Throwable t)
public static java.lang.Throwable unwrapCause(java.lang.Throwable t)
public static java.lang.String detailedMessage(java.lang.Throwable t)
public static java.lang.String detailedMessage(java.lang.Throwable t, boolean newLines, int initialCounter)
public static java.lang.String stackTrace(java.lang.Throwable e)
public static <T extends java.lang.Throwable> void rethrowAndSuppress(java.util.List<T> exceptions) throws T extends java.lang.Throwable
T extends java.lang.Throwable
public static <T extends java.lang.Throwable> void maybeThrowRuntimeAndSuppress(java.util.List<T> exceptions)
public static <T extends java.lang.Throwable> T useOrSuppress(T first, T second)
public static java.io.IOException unwrapCorruption(java.lang.Throwable t)
public static java.lang.Throwable unwrap(java.lang.Throwable t, java.lang.Class<?>... clazzes)
public static boolean isOOM(java.lang.Throwable t)
true
iff the given throwable is and OutOfMemoryException, otherwise false
public static boolean reThrowIfNotNull(@Nullable java.lang.Throwable e)
true
is returned.public static ShardOperationFailedException[] groupBy(ShardOperationFailedException[] failures)