Exception: JabberAdmin::Error

Inherits:
StandardError
  • Object
show all
Defined in:
lib/jabber_admin/errors.rb

Overview

The base exception which all other exceptions inherit. In case you want to use our error handling with the bang variants, you can rescue all exceptions like this:

begin
  JabberAdmin.COMMAND!
rescue JabberAdmin::Error => err
  # Do your error handling here
end

Direct Known Subclasses

CommandError, RequestError, UnknownCommandError

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(msg, response = nil) ⇒ Error

Create a new exception.

Parameters:

  • msg (String)

    the excpetion message

  • response (RestClient::Response) (defaults to: nil)

    the response when available



20
21
22
23
24
# File 'lib/jabber_admin/errors.rb', line 20

def initialize(msg, response = nil)
  @response = response
  msg += " => #{response.body}" if response&.body
  super(msg)
end

Instance Attribute Details

#responseObject

Returns the value of attribute response.



14
15
16
# File 'lib/jabber_admin/errors.rb', line 14

def response
  @response
end