Class ThrowableUtils
- java.lang.Object
-
- software.amazon.awssdk.core.internal.util.ThrowableUtils
-
public final class ThrowableUtils extends Object
Utility for use with errors or exceptions.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static SdkException
asSdkException(Throwable t)
Wraps the givenThrowable
inSdkException
if necessary.static RuntimeException
failure(Throwable t)
Used to help perform common throw-up with minimal wrapping.static RuntimeException
failure(Throwable t, String errmsg)
Same asfailure(Throwable)
, but the given errmsg will be used if it was wrapped as either anSdkClientException
orAbortedException
.static Throwable
getRootCause(Throwable orig)
Returns the root cause of the given cause, or null if the given cause is null.
-
-
-
Method Detail
-
getRootCause
public static Throwable getRootCause(Throwable orig)
Returns the root cause of the given cause, or null if the given cause is null. If the root cause is over 1000 level deep, the original cause will be returned defensively as this is heuristically considered a circular reference, however unlikely.
-
failure
public static RuntimeException failure(Throwable t)
Used to help perform common throw-up with minimal wrapping.
-
failure
public static RuntimeException failure(Throwable t, String errmsg)
Same asfailure(Throwable)
, but the given errmsg will be used if it was wrapped as either anSdkClientException
orAbortedException
.
-
asSdkException
public static SdkException asSdkException(Throwable t)
Wraps the givenThrowable
inSdkException
if necessary.
-
-