Exception: Hurley::ClientError
Direct Known Subclasses
ConnectionFailed, ParsingError, ResourceNotFound, SSLError, Timeout
Instance Attribute Summary collapse
-
#response ⇒ Object
readonly
Returns the value of attribute response.
Instance Method Summary collapse
- #backtrace ⇒ Object
-
#initialize(ex, response = nil) ⇒ ClientError
constructor
A new instance of ClientError.
- #inspect ⇒ Object
Constructor Details
#initialize(ex, response = nil) ⇒ ClientError
Returns a new instance of ClientError.
53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/hurley.rb', line 53 def initialize(ex, response = nil) @wrapped_exception = nil @response = response if ex.respond_to?(:backtrace) super(ex.) @wrapped_exception = ex elsif ex.respond_to?(:status_code) super("the server responded with status #{ex.status_code}") @response = ex else super(ex.to_s) end end |
Instance Attribute Details
#response ⇒ Object (readonly)
Returns the value of attribute response.
51 52 53 |
# File 'lib/hurley.rb', line 51 def response @response end |
Instance Method Details
#backtrace ⇒ Object
68 69 70 71 72 73 74 |
# File 'lib/hurley.rb', line 68 def backtrace if @wrapped_exception @wrapped_exception.backtrace else super end end |
#inspect ⇒ Object
76 77 78 |
# File 'lib/hurley.rb', line 76 def inspect %(#<#{self.class}: #{@wrapped_exception.class}>) end |