class Splunk::SplunkHTTPError
Exception to represent all errors returned from Splunkd.
The important information about the error is available as a set of accessors:
-
code
: The HTTP error code returned. -
reason
: The reason field of the HTTP response header. -
detail
: The detailed error message Splunk sent in the response body.
You can also get the original response body from body
and any HTTP headers returns from headers
.
Attributes
body[R]
code[R]
detail[R]
headers[R]
reason[R]
Public Class Methods
new(response)
click to toggle source
Calls superclass method
# File lib/splunk-sdk-ruby/splunk_http_error.rb, line 39 def initialize(response) @body = response.body @detail = Splunk::text_at_xpath("//msg", response.body) @reason = response.message @code = Integer(response.code) @headers = response.each().to_a() super("HTTP #{@code.to_s} #{@reason}: #{@detail || ""}") end