Exception: RestRequestor::StandardError
- Inherits:
-
StandardError
- Object
- StandardError
- RestRequestor::StandardError
- Defined in:
- lib/rest_requestor.rb
Direct Known Subclasses
Instance Method Summary collapse
-
#initialize(uri, verb, resp, params = {}, msg: nil) ⇒ StandardError
constructor
A new instance of StandardError.
Constructor Details
#initialize(uri, verb, resp, params = {}, msg: nil) ⇒ StandardError
Returns a new instance of StandardError.
12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/rest_requestor.rb', line 12 def initialize(uri, verb, resp, params = {}, msg: nil) body = if resp["Content-Type"]&.include?("text/html") if (m = resp.body.to_s.match(/<title>(.*)<\/title>/)) m[1] else resp.body.to_s[0..20] end else resp.body.to_s end msg ||= "uri: #{uri}, Verb: #{verb}, Resp: #{resp.code} - #{resp.}, Body: #{body}, Params: #{params}" super(msg) end |