Exception: Lago::Api::HttpError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/lago/api/http_error.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(code, body, uri) ⇒ HttpError

Returns a new instance of HttpError.



8
9
10
11
12
# File 'lib/lago/api/http_error.rb', line 8

def initialize(code, body, uri)
  @error_code = code
  @error_body = body
  @uri = uri
end

Instance Attribute Details

#error_bodyObject (readonly)

Returns the value of attribute error_body.



6
7
8
# File 'lib/lago/api/http_error.rb', line 6

def error_body
  @error_body
end

#error_codeObject (readonly)

Returns the value of attribute error_code.



6
7
8
# File 'lib/lago/api/http_error.rb', line 6

def error_code
  @error_code
end

#uriObject (readonly)

Returns the value of attribute uri.



6
7
8
# File 'lib/lago/api/http_error.rb', line 6

def uri
  @uri
end

Instance Method Details

#json_messageObject



18
19
20
# File 'lib/lago/api/http_error.rb', line 18

def json_message
  JSON.parse(error_body)
end

#messageObject



14
15
16
# File 'lib/lago/api/http_error.rb', line 14

def message
  "HTTP #{error_code} - URI: #{uri}.\nError: #{error_body}"
end