Class: HorizonClient::ClientError

Inherits:
Faraday::ClientError
  • Object
show all
Defined in:
lib/horizon_client.rb

Instance Method Summary collapse

Constructor Details

#initialize(e) ⇒ ClientError

Returns a new instance of ClientError.



12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/horizon_client.rb', line 12

def initialize(e)
  message = e.message
  if e.response.is_a?(Hash)
    body = e.response[:body]
    if body.is_a?(Hash)
      error = body['error']
      if error.is_a?(Hash)
        message += ": #{error['message']}"
      end
    end
  end
  super message
end