AWS services or capabilities described in AWS Documentation may vary by region/location. Click Getting Started with Amazon AWS to see specific differences applicable to the China (Beijing) Region.

Module: Aws::EC2::Errors

Defined in:
gems/aws-sdk-ec2/lib/aws-sdk-ec2/errors.rb

Overview

When EC2 returns an error response, the Ruby SDK constructs and raises an error. These errors all extend Aws::EC2::Errors::ServiceError < Aws::Errors::ServiceError

You can rescue all EC2 errors using ServiceError:

begin
  # do stuff
rescue Aws::EC2::Errors::ServiceError
  # rescues all EC2 API errors
end

Request Context

ServiceError objects have a #context method that returns information about the request that generated the error. See Seahorse::Client::RequestContext for more information.

Error Classes

Additionally, error classes are dynamically generated for service errors based on the error code if they are not defined above.