User guide

To allow developers fine-grained control over the errors they want to handle without forcing them to
handle exceptional cases they aren't concerned about (and making their code overly verbose)
To prevent scalability issues inherent with checked exceptions in large applications
In general, checked exceptions work well on small scales, but can become troublesome as applications
grow and become more complex.
For more information about the use of checked and unchecked exceptions, see the following articles:
Unchecked Exceptions—The Controversy
The Trouble with Checked Exceptions
Java's checked exceptions were a mistake (and here's what I would like to do about it)
AmazonServiceException (and Subclasses)
This is the main type of exception that you'll need to deal with when using the AWS SDK for Java. This
exception represents an error response from an AWS service. For example, if you request to terminate
an Amazon EC2 instance that doesn't exist, EC2 will return an error response and all the details of that
error response will be included in the thrown AmazonServiceException. For some cases, a subclass
of AmazonServiceException will be thrown to allow developers fine grained control over handling error
cases through catch blocks.
When you encounter an AmazonServiceException, you know that your request was successfully sent
to the AWS service, but could not be successfully processed either because of errors in the request's
parameters or because of issues on the service side.
AmazonServiceException has several useful fields in it, including:
Returned HTTP status code
Returned AWS error code
Detailed error message from the service
AWS request ID for the failed request
AmazonServiceException also includes a field that describes whether the failed request was the
caller's fault (i.e., a request with illegal values) or the AWS service's fault (i.e., an internal service error).
AmazonClientException
This exception indicates that a problem occurred inside the Java client code, either while trying to send
a request to AWS or while trying to parse a response from AWS. AmazonClientException exceptions
are more severe than AmazonServiceException exceptions and indicate a major problem that is
preventing the client from being able to make service calls to AWS services. For example, the AWS Java
SDK will throw an AmazonClientException if no network connection is available when you try to call
an operation on one of the clients.
IllegalArgumentException
When calling operations, if you pass an illegal argument, the AWS SDK for Java will throw an
IllegalArgumentException. For example, if you call an operation and pass a null value in for one of
the required parameters, the SDK will throw an IllegalArgumentException describing the illegal
argument.
Version v1.0.0
14
AWS SDK for Java Developer Guide
Exception Handling