Exception: Jabber::ServerError

Inherits:
JabberError show all
Defined in:
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

- (ServerError) initialize(error)

Initialize a ServerError by passing an ErrorResponse instance

error

Error


35
36
37
# File 'lib/xmpp4r/errors.rb', line 35

def initialize(error)
  @error = error
end

Instance Attribute Details

- (Object) error (readonly)

The error element which caused this exception



30
31
32
# File 'lib/xmpp4r/errors.rb', line 30

def error
  @error
end

Instance Method Details

- (Object) to_s

Sample output: 'subscription-required: Please subscribe first'



42
43
44
# File 'lib/xmpp4r/errors.rb', line 42

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