Exception: LHC::Error
- Inherits:
-
StandardError
- Object
- StandardError
- LHC::Error
- Defined in:
- lib/lhc/error.rb
Direct Known Subclasses
ClientError, ParserError, ServerError, Timeout, UnknownError
Instance Attribute Summary collapse
-
#_message ⇒ Object
Returns the value of attribute _message.
-
#response ⇒ Object
Returns the value of attribute response.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(message, response) ⇒ Error
constructor
A new instance of Error.
- #to_s ⇒ Object
Constructor Details
#initialize(message, response) ⇒ Error
Returns a new instance of Error.
49 50 51 52 53 |
# File 'lib/lhc/error.rb', line 49 def initialize(, response) super() self. = self.response = response end |
Instance Attribute Details
#_message ⇒ Object
Returns the value of attribute _message.
3 4 5 |
# File 'lib/lhc/error.rb', line 3 def @_message end |
#response ⇒ Object
Returns the value of attribute response.
3 4 5 |
# File 'lib/lhc/error.rb', line 3 def response @response end |
Class Method Details
.find(response) ⇒ Object
41 42 43 44 45 46 47 |
# File 'lib/lhc/error.rb', line 41 def self.find(response) return LHC::Timeout if response.timeout? status_code = response.code.to_s[0..2].to_i error = map[status_code] error ||= LHC::UnknownError error end |
.map ⇒ Object
Instance Method Details
#to_s ⇒ Object
55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/lhc/error.rb', line 55 def to_s request = response.request debug = [] debug << "#{request.method} #{request.url}" debug << "Params: #{request.}" debug << "Headers: #{request.headers}" debug << "Response Code: #{response.code}" debug << response.body debug << debug.join("\n") end |