Class SdkException
- java.lang.Object
-
- java.lang.Throwable
-
- java.lang.Exception
-
- java.lang.RuntimeException
-
- software.amazon.awssdk.core.exception.SdkException
-
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
SdkClientException,SdkServiceException
public class SdkException extends RuntimeException
Base class for SDK-specific exceptions. Note that network operations may throw UncheckedIOException or propagate other RuntimeExceptions directly rather than wrapping them in SdkException.- See Also:
SdkServiceException,SdkClientException, Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceSdkException.Builderprotected static classSdkException.BuilderImpl
-
Constructor Summary
Constructors Modifier Constructor Description protectedSdkException(SdkException.Builder builder)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static SdkException.Builderbuilder()static SdkExceptioncreate(String message, Throwable cause)IntegernumAttempts()Returns the number of attempts made before this exception was thrown.StringrawMessage()Returns the raw message of this exception without any additional formatting.booleanretryable()Specifies whether or not an exception can be expected to succeed on a retry.SdkException.BuildertoBuilder()Create aSdkException.Builderinitialized with the properties of thisSdkException.-
Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
-
-
-
Constructor Detail
-
SdkException
protected SdkException(SdkException.Builder builder)
-
-
Method Detail
-
numAttempts
public Integer numAttempts()
Returns the number of attempts made before this exception was thrown. This includes the initial attempt and any retries.- Returns:
- The number of attempts made, or null if not set
-
rawMessage
public String rawMessage()
Returns the raw message of this exception without any additional formatting. This is used internally to construct the complete exception message.- Returns:
- The raw exception message
-
create
public static SdkException create(String message, Throwable cause)
-
retryable
public boolean retryable()
Specifies whether or not an exception can be expected to succeed on a retry.
-
toBuilder
public SdkException.Builder toBuilder()
Create aSdkException.Builderinitialized with the properties of thisSdkException.- Returns:
- A new builder initialized with this config's properties.
-
builder
public static SdkException.Builder builder()
- Returns:
SdkException.Builderinstance to construct a newSdkException.
-
-