Exception: CyberCoach::HttpError

Inherits:
RuntimeError
  • Object
show all
Defined in:
lib/cybercoach/http_error.rb

Overview

Raised when a response is unsuccessful.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(cause) ⇒ HttpError

Creates a HttpError.

cause

The response that caused it.



15
16
17
18
# File 'lib/cybercoach/http_error.rb', line 15

def initialize(cause)
  super
  @cause = cause
end

Instance Attribute Details

#causeObject

The response that caused it.



9
10
11
# File 'lib/cybercoach/http_error.rb', line 9

def cause
  @cause
end

Instance Method Details

#to_sObject

Returns a string representation including the cause’s header and body.



23
24
25
# File 'lib/cybercoach/http_error.rb', line 23

def to_s
  "#{super}\n\t#{@cause.to_hash}\n\t#{@cause.body}"
end