Exception: Rasti::AI::Errors::RequestFail

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(url, body, response) ⇒ RequestFail

Returns a new instance of RequestFail.



9
10
11
12
13
# File 'lib/rasti/ai/errors.rb', line 9

def initialize(url, body, response)
  @url = url
  @body = body
  @response = response
end

Instance Attribute Details

#bodyObject (readonly)

Returns the value of attribute body.



7
8
9
# File 'lib/rasti/ai/errors.rb', line 7

def body
  @body
end

#responseObject (readonly)

Returns the value of attribute response.



7
8
9
# File 'lib/rasti/ai/errors.rb', line 7

def response
  @response
end

#urlObject (readonly)

Returns the value of attribute url.



7
8
9
# File 'lib/rasti/ai/errors.rb', line 7

def url
  @url
end

Instance Method Details

#messageObject



15
16
17
# File 'lib/rasti/ai/errors.rb', line 15

def message
  "Request fail\nRequest: #{url}\n#{JSON.pretty_generate(body)}\nResponse: #{response.code}\n#{response.body}"
end