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)


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