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.



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

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.



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

def nested_error
  @nested_error
end

#response_bodyObject (readonly)

Returns the value of attribute response_body.



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

def response_body
  @response_body
end

Instance Method Details

#messageObject



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

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