Select your cookie preferences

We use essential cookies and similar tools that are necessary to provide our site and services. We use performance cookies to collect anonymous statistics, so we can understand how customers use our site and make improvements. Essential cookies cannot be deactivated, but you can choose “Customize” or “Decline” to decline performance cookies.

If you agree, AWS and approved third parties will also use cookies to provide useful site features, remember your preferences, and display relevant content, including relevant advertising. To accept or decline all non-essential cookies, choose “Accept” or “Decline.” To make more detailed choices, choose “Customize.”

You are viewing documentation for version 1 of the AWS SDK for Ruby. Version 2 documentation can be found here.

Exception: AWS::Errors::Base

Inherits:
StandardError
  • Object
show all
Defined in:
lib/aws/errors.rb

Overview

Base class for all errors returned by the service.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#new(error_message) ⇒ Base #new(http_request, http_response, code = nil, message = nil) ⇒ Base

Returns a new instance of Base

Overloads:

  • #new(error_message) ⇒ Base

    Parameters:

    • error_message (String)

      The body of the error message

  • #new(http_request, http_response, code = nil, message = nil) ⇒ Base

    Parameters:

    • http_request (Http::Request)
    • http_response (Http::Response)
    • code (String) (defaults to: nil)

      (nil)

    • message (String) (defaults to: nil)

      (nil)

[View source]

52
53
54
55
56
57
58
59
60
61
62
# File 'lib/aws/errors.rb', line 52

def initialize req = nil, resp = nil, code = nil, message = nil
  if req.is_a?(String) or req.nil?
    super(req)
  else
    @http_request = req
    @http_response = resp
    @code = code
    include_error_type
    super(message || http_response.body)
  end
end

Instance Attribute Details

#codeString (readonly)

Returns The response code given by the service.

Returns:

  • (String)

    The response code given by the service.


65
66
67
# File 'lib/aws/errors.rb', line 65

def code
  @code
end

#http_requestHttp::Request (readonly)

Returns The low level http request that caused the error to be raised.

Returns:

  • (Http::Request)

    The low level http request that caused the error to be raised.


69
70
71
# File 'lib/aws/errors.rb', line 69

def http_request
  @http_request
end

#http_responseHttp::Response (readonly)

Returns The low level http response from the service that wrapped the service error.

Returns:

  • (Http::Response)

    The low level http response from the service that wrapped the service error.


73
74
75
# File 'lib/aws/errors.rb', line 73

def http_response
  @http_response
end