Exception: Jabber::ServerError

Inherits:
JabberError show all
Defined in:
lib/gems/xmpp4r-0.4/lib/xmpp4r/errors.rb

Overview

An error returned from the server

e.g. This exception can be raised by helpers when they receive a server reply with type='error'

The ServerError carries a Jabber::ErrorResponse element

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(error) ⇒ ServerError

Initialize a ServerError by passing an ErrorResponse instance

error
Error


32
33
34
# File 'lib/gems/xmpp4r-0.4/lib/xmpp4r/errors.rb', line 32

def initialize(error)
  @error = error
end

Instance Attribute Details

#errorObject (readonly)

The error element which caused this exception



27
28
29
# File 'lib/gems/xmpp4r-0.4/lib/xmpp4r/errors.rb', line 27

def error
  @error
end

Instance Method Details

#to_sObject

Sample output: ‘subscription-required: Please subscribe first’



39
40
41
# File 'lib/gems/xmpp4r-0.4/lib/xmpp4r/errors.rb', line 39

def to_s
  "#{@error.error}: #{@error.text}"
end