Exception: JaLC::REST::HTTPError
- Defined in:
- lib/jalc/rest/middleware/raise_error.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#response ⇒ Object
readonly
Returns the value of attribute response.
Instance Method Summary collapse
-
#initialize(msg = nil, response: nil) ⇒ HTTPError
constructor
A new instance of HTTPError.
- #inspect ⇒ Object
Constructor Details
#initialize(msg = nil, response: nil) ⇒ HTTPError
Returns a new instance of HTTPError.
45 46 47 48 49 50 51 |
# File 'lib/jalc/rest/middleware/raise_error.rb', line 45 def initialize(msg = nil, response: nil) @response = response msg ||= response[:body].dig('message', 'errors', 'message') if response && response[:body].is_a?(Hash) msg ||= "the server responded with status #{response[:status]}" if response super(msg) end |
Instance Attribute Details
#response ⇒ Object (readonly)
Returns the value of attribute response.
43 44 45 |
# File 'lib/jalc/rest/middleware/raise_error.rb', line 43 def response @response end |
Instance Method Details
#inspect ⇒ Object
53 54 55 56 57 58 59 |
# File 'lib/jalc/rest/middleware/raise_error.rb', line 53 def inspect if response %(#<#{self.class} response=#{response.inspect}>) else super end end |