Exception: CircuitApi::HttpError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/circuit_api/utils/errors.rb

Overview

Network Errors

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(code, body, uri) ⇒ HttpError

Returns a new instance of HttpError.



6
7
8
9
10
# File 'lib/circuit_api/utils/errors.rb', line 6

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.



4
5
6
# File 'lib/circuit_api/utils/errors.rb', line 4

def error_body
  @error_body
end

#error_codeObject (readonly)

Returns the value of attribute error_code.



4
5
6
# File 'lib/circuit_api/utils/errors.rb', line 4

def error_code
  @error_code
end

#uriObject (readonly)

Returns the value of attribute uri.



4
5
6
# File 'lib/circuit_api/utils/errors.rb', line 4

def uri
  @uri
end

Instance Method Details

#json_messageObject



16
17
18
# File 'lib/circuit_api/utils/errors.rb', line 16

def json_message
  JSON.parse(error_body)
end

#messageObject



12
13
14
# File 'lib/circuit_api/utils/errors.rb', line 12

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