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 SdkExceptionasSdkException(Throwable t)Wraps the givenThrowableinSdkExceptionif necessary.static RuntimeExceptionfailure(Throwable t)Used to help perform common throw-up with minimal wrapping.static RuntimeExceptionfailure(Throwable t, String errmsg)Same asfailure(Throwable), but the given errmsg will be used if it was wrapped as either anSdkClientExceptionorAbortedException.static ThrowablegetRootCause(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 anSdkClientExceptionorAbortedException.
-
asSdkException
public static SdkException asSdkException(Throwable t)
Wraps the givenThrowableinSdkExceptionif necessary.
-
-