Exception: ApiAi::Error

Inherits:
RuntimeError
  • Object
show all
Defined in:
lib/api_ai/error.rb

Overview

This is the usual error raised on any api.ai related Errors

Direct Known Subclasses

AuthError

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(error, http_response = nil) ⇒ Error

Returns a new instance of Error.



14
15
16
17
# File 'lib/api_ai/error.rb', line 14

def initialize(error, http_response = nil)
  @error = error
  @http_response = http_response
end

Instance Attribute Details

#errorString

Returns the name of the error.

Returns:

  • (String)

    the name of the error



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

class Error < RuntimeError

  attr_accessor :http_response, :error

  def initialize(error, http_response = nil)
    @error = error
    @http_response = http_response
  end

  # String representation
  # @return [String]
  def to_s
    "#{error}"
  end
end

#http_responseObject

Returns server response.

Returns:

  • (Object)

    server response



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

class Error < RuntimeError

  attr_accessor :http_response, :error

  def initialize(error, http_response = nil)
    @error = error
    @http_response = http_response
  end

  # String representation
  # @return [String]
  def to_s
    "#{error}"
  end
end

Instance Method Details

#to_sString

String representation

Returns:

  • (String)


21
22
23
# File 'lib/api_ai/error.rb', line 21

def to_s
  "#{error}"
end