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 all exceptions thrown by the SDK.- See Also:
SdkServiceException
,SdkClientException
, Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
SdkException.Builder
protected static class
SdkException.BuilderImpl
-
Constructor Summary
Constructors Modifier Constructor Description protected
SdkException(SdkException.Builder builder)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static SdkException.Builder
builder()
static SdkException
create(String message, Throwable cause)
Integer
numAttempts()
Returns the number of attempts made before this exception was thrown.String
rawMessage()
Returns the raw message of this exception without any additional formatting.boolean
retryable()
Specifies whether or not an exception can be expected to succeed on a retry.SdkException.Builder
toBuilder()
Create aSdkException.Builder
initialized 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.Builder
initialized with the properties of thisSdkException
.- Returns:
- A new builder initialized with this config's properties.
-
builder
public static SdkException.Builder builder()
- Returns:
SdkException.Builder
instance to construct a newSdkException
.
-
-