Exception: OpenfireAdmin::ResponceException
- Inherits:
-
Exception
- Object
- Exception
- OpenfireAdmin::ResponceException
- Defined in:
- lib/openfire_admin/response_exception.rb
Overview
unexpected response found exception
Instance Attribute Summary collapse
-
#response ⇒ Object
readonly
Returns the value of attribute response.
Instance Method Summary collapse
-
#initialize(message, res) ⇒ ResponceException
constructor
A new instance of ResponceException.
Constructor Details
#initialize(message, res) ⇒ ResponceException
Returns a new instance of ResponceException.
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/openfire_admin/response_exception.rb', line 8 def initialize(,res) case res when Net::HTTPSuccess doc = HtmlParser.new(res.body) msgs = ( doc.search('//*[contains(@class,"jive-error-text") or contains(@class , "error")]') || [] ).map{|c| c.text.strip} if msgs.empty? super() else super("#{} [#{msgs.join(' / ')}]") end when Net::HTTPRedirection super("#{} redirct to=>#{res['location']}") when Net::HTTPNotFound super("#{} Not found #{res.request.path}") else super("#{} res.code=#{res.code}") end @response = res end |
Instance Attribute Details
#response ⇒ Object (readonly)
Returns the value of attribute response.
7 8 9 |
# File 'lib/openfire_admin/response_exception.rb', line 7 def response @response end |