Exception: Helo::Core::APIError
- Inherits:
-
StandardError
- Object
- StandardError
- Helo::Core::APIError
- Defined in:
- lib/helo/core/api_error.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#code ⇒ Object
readonly
Returns the value of attribute code.
-
#response_body ⇒ Object
readonly
Returns the value of attribute response_body.
-
#response_headers ⇒ Object
readonly
Returns the value of attribute response_headers.
Instance Method Summary collapse
-
#initialize(message = nil, code: nil, response_body: nil, response_headers: nil) ⇒ APIError
constructor
A new instance of APIError.
- #message ⇒ Object
Constructor Details
#initialize(message = nil, code: nil, response_body: nil, response_headers: nil) ⇒ APIError
Returns a new instance of APIError.
7 8 9 10 11 12 13 |
# File 'lib/helo/core/api_error.rb', line 7 def initialize( = nil, code: nil, response_body: nil, response_headers: nil) @message = @code = code @response_body = response_body @response_headers = response_headers super() end |
Instance Attribute Details
#code ⇒ Object (readonly)
Returns the value of attribute code.
5 6 7 |
# File 'lib/helo/core/api_error.rb', line 5 def code @code end |
#response_body ⇒ Object (readonly)
Returns the value of attribute response_body.
5 6 7 |
# File 'lib/helo/core/api_error.rb', line 5 def response_body @response_body end |
#response_headers ⇒ Object (readonly)
Returns the value of attribute response_headers.
5 6 7 |
# File 'lib/helo/core/api_error.rb', line 5 def response_headers @response_headers end |
Instance Method Details
#message ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/helo/core/api_error.rb', line 15 def msg = @message msg += "\nHTTP status code: #{code}" if code msg += "\nResponse headers: #{response_headers}" if response_headers msg += "\nResponse body: #{response_body}" if response_body msg end |