Exception: HttpApiClient::Errors::BaseError

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message, response_body, nested_error = nil) ⇒ BaseError

Returns a new instance of BaseError.



12
13
14
15
16
17
# File 'lib/http_api_client/errors.rb', line 12

def initialize(message, response_body, nested_error = nil)
  super(message)
  @message = message
  @response_body = response_body
  @nested_error = nested_error
end

Instance Attribute Details

#nested_errorObject (readonly)

Returns the value of attribute nested_error.



10
11
12
# File 'lib/http_api_client/errors.rb', line 10

def nested_error
  @nested_error
end

#response_bodyObject (readonly)

Returns the value of attribute response_body.



10
11
12
# File 'lib/http_api_client/errors.rb', line 10

def response_body
  @response_body
end

Instance Method Details

#messageObject



19
20
21
22
23
24
# File 'lib/http_api_client/errors.rb', line 19

def message
  messages = [@message]
  messages << nested_error.message if nested_error
  messages << response_body
  messages.join(", ")
end